关于Spring与Velocity结合的问题(获得request,session)

ARR+Velocity:2009年微软分布式架构的现代启示 应用层负载均衡与分布式缓存是构建高可用Web系统的两大基石。ARR(Application Request Routing)作为IIS原生的七层路由引擎,通过URL Rewrite实现语义化流量分发;Velocity则以内存网格架构提供强一致、可配置副本的分布式缓存能力。二者协同解决了流量智能调度、状态安全共享与故障无感恢复三大核心问题。尽管诞生于.NET Web Farm时代,其设计思想——如路径路由规则、健康探针联动、一致性哈希分片、副本自动切换——深刻影响了Kubernetes Ingress、Env 阅读详情

近期正在学习Spring框架,使用Spring MVC。显示使用Velocity找到一篇相关的文档,作为参考资料


视图解析器的一些属性
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="exposeSpringMacroHelpers" value="true"/>
<property name="requestContextAttribute" value="rc"/>
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/"/>
<property name="suffix" value=".jsp"/>
</bean>

在 视图解析器的定义中,"exposeSpringMacroHelpers"设置是否通过Spring的宏库暴露一个RequestContext(名为 springBindRequestContext)供外部使用,默认值为false。它暴露了处理表单和验证错误信息的宏操作;

"requestContextAttribute" 把Spring的RequestContext对象暴露为变量rc。利用${rc.contextPath}来获取应用程序的contextPath(也 就是/MyUsers);利用${rc.getMessage("user.name")}读取/WEB- INF/classes/messages.properties本地化信息。此对象对于那些不访问serlvet请求的View技术(也就是 Velocity和FreeMarker模板)来说是必不可少的。

还有一些属性:

exposeRequestAttributes:默认值false,设置是否所有的request属性在与模板进行合并之前添加到model中。(可以理解为request范围内包含的所有对象,而不是一个真正的Request对象。)

exposeSessionAttributes:默认值false,设置是否所有的session属性在与模板进行合并之前添加到model中。(理解同上) 
三、分区配置 rk3566/rk3568 修改分区 阅读详情

相关推荐

Ubuntu下OpenOCD+GDB的安装、编译及使用

目标开发板(芯片):stm32mp157aaa 仿真器:ST-Link 操作系统:Ubuntu 18.04 调试软件:OpenOCD OpenOCD的安装 首先下载OpenOCD有多种方式,可以GitHub上下载,目录下打开终端,输入 git clone git://git.code.sf.net/p/openocd/code openocd 下载完整的OpenOCD的文件夹。进入到OpenOCD的目录下,开始安装。 接着,OpenOCD适用于微处理器的debug和烧写,需要下载相关库 sud

蓝冰露的博客 9542

velocity源码分析:上下文承载类

老规矩,线上类图 由于这个代码结构比较简单,因此不做介绍,具体代码的缝合点在具体功能点中介绍(涉及到ast)。 记住几个点即可: 1.VelocityContexty可作为所有上下文承载点,因为其实现了三个接口:Context,InternalEventContext,InternalHousekeepingContext 2.InternalContextBase是个

madding 2797

手把手教你安装 Vivado2022.2(附安装包)

Vivado 2022.2版本与之前的版本相比,具有以下几个显著的优势:电源设计管理器(PDM):Vivado 2022.2引入了全新的电源设计管理器(PDM),这是一个下一代功耗评估平台,为Versal® 和 Kria™ SOM提供了准确一致的功耗估计能力。PDM是Versal产品家族的首选功耗评估工具,为Versal ACAP硬IP块提供增强向导,简化从XPE向PDM的迁移,帮助用户获得准确的功耗评估。

dpwkj的博客 2万+

java velocitycontext_CHAPTER 6 理解模板和上下文

在之前的章节里,我们介绍了Velocity和Hello World示例,并从中看到了Velocity的一些简单应用,是时候学习Velocity核心组件了。本章将深入学习模板和上下文。后续章节将在本章知识的基础上,详细讨论Velocity的引用、指令和宏。使用模板Velocity是一个模板引擎,使用Velocity进行开发将是一件非常愉快的事。但是如何来制作模板呢?Velocity的模板定义和许多领...

weixin_42412324的博客 1164

告别卡顿!OBS Studio最佳录制参数设置指南(适合游戏/网课/会议场景)

本文提供OBS Studio录制参数优化指南,针对游戏、网课及会议三大场景,详细解析帧率、码率与编码器设置。重点推荐利用硬件编码器(如NVENC)实现游戏录制零卡顿,并分享清晰稳定的网课录制与长时间会议录制配置方案,助你告别视频卡顿与音画不同步问题。

e4f5g6h7的博客 1357

代谢组数据分析(二十六):LC-MS/MS代谢组学和脂质组学数据的分析流程

本教程概述了LC-MS/MS在代谢组学和脂质组学数据分析中的应用流程。首先介绍了样本的采集、提取和LC-MS/MS分析,随后详细阐述了质谱数据的预处理、峰值识别、特征注释,以及数据标准化和统计分析的重要性。特别强调了使用XCMS和CAMERA进行数据对齐和加合物识别,以及利用MultiABLER和LipidFinder进行数据过滤、插补和标准化处理。此外,还介绍了如何应用EigenMS算法进行数据标准化,以及如何使用Limma包进行差异分析。整个流程旨在提高数据质量,确保分析结果的准确性和可靠性,为后续的生

专注生信领域 1983

velcoity使用说明:velocity基础

概述: velocity是一个典型的model和view分离设计思想的体现,因此其概念定义的几个主要元素和mvc中的概念也有一定的隐射关系。 比较重要的几个概念: 1.VelocityContext:velocity上下文,用来保存数据用的,主要是工程师书写代码是放数据用的,提供给模板使用 2.Template:模板,设计师设计的页面的加载器,具体的数据则由Velocity

tianhe8的专栏 991

OpenClaw对接本地大模型:Llama3/Qwen/ChatGLM全适配,完全私有化部署

OpenClaw对接本地大模型,是企业级AI智能体落地的必经之路——它不仅解决了数据隐私和合规问题,还能大幅降低成本、提升响应速度、实现定制化。这篇文章我给大家完整拆解了两套部署方案:Ollama(新手首选,5分钟搞定)和vLLM(生产环境首选,高性能),覆盖了Llama3/Qwen/ChatGLM三大主流模型,还有真实的落地案例、高级优化、踩坑避坑指南,看完你就能零代码完成完全私有化的部署。从零开发自定义工具,给OpenClaw添加专属业务能力;

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 812

Velocity的简单使用

velocity 简介 Velocity是一个基于java的模板引擎(template engine),它允许任何人仅仅简单的使用模板语言(template language)来引用由java代码定义的对象。它作为一款成熟的基于java的模板引擎,能够帮我们实现页面静态化,同时它将Java代码与网页分开,使网站在其生命周期内更加可维护,并为Java Server Pages(JSP)或PHP提供了可行的替代方案。 基本语法 # Velocity关键字都是使用#开头的,如#set、#if、#else、#e

罗罗的1024 2万+

FPGA和USB3.0通信-USB3.0 PHY介绍

可以和FPGA搭配使用的USB3.0 PHY芯片通过之前的介绍<FPGA和USB3.0通信-USB3.0协议介绍USB3.0 PHY简介首先我们需要了解PHY具体完成哪些工作以及我利...

OpenFPGA的博客 4946

2023年全国青少年信息素养大赛C++编程初中组决赛真题+答案解析

2023年全国青少年信息素养大赛C++编程初中组决赛真题+答案解析

伶俐角少儿编程 823

SpringBoot配置属性之MVC

SpringBoot配置属性系列 SpringBoot配置属性之MVC SpringBoot配置属性之Server SpringBoot配置属性之DataSource SpringBoot配置属性之NOSQL SpringBoot配置属性之MQ SpringBoot配置属性之Security SpringBoot配置属性之Migrati...

weixin_34221332的博客 816

04 Zabbix自定义触发器

1、触发器是什么 触发器表达式:允许定义一个什么状况的数据是“可接受”的阈值。因此,如果接收的数据超过了可接受的状态,则触发器会被触发 , 或将状态更改为异常。 一个触发器可以拥有下面几种状态: 值 描述 OK 这是一个正常的触发器状态。在旧版本的Zabbix中称为FALSE。 PROBLEM 通常意味着发生了某些事情。例如,处理器的负载较高。在旧版本的Zabbix中称为TRUE。 2、创建触发器TRIGGER 案例:系统超过3个用户登录,则告警。 2.1 开启告警声

Jian Sun_的博客 1549

velocity 变量 获取_velocity 怎么得到项目根路径

关于Spring与Velocity结合的问题(获得request,session)视图解析器的一些属性class="org.springframework.web.servlet.view.InternalResourceViewResolver">在 视图解析器的定义中,"exposeSpringMacroHelpers"设置是否通过Spring的宏库暴露一个RequestContext(...

weixin_30935961的博客 401

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

freemarker Velocity获取request,session

freemarker 获取request 和 session <bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"&g...

chuque4897的博客 123

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

velocity获取session中的属性值

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34044273的博客 708

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

Spring MVC 4.0 + Velocity Tools 2.0遇到的问题

1、Spring MVC 4.0及更高版本不建议使用Velocity模板引擎,为了继承Velocity并使用Velocity Tools,需要重写viewClass,如下:import org.apache.velocity.context.Context; import org.apache.velocity.tools.Scope; import org.apache.velocity.tool

totally123的专栏 1786

Spring velocity

视图解析器的一些属性&lt;bean id="viewResolver"class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;&lt;property name="exposeSpringMacroHelpers" value="true"/&gt;&lt;property name=&qu

xumingrencai 85

Spring采用velicity视图时,使用@SessionAttributes("")注解出现Cannot expose session attribute 'user' because of an

Spring采用velicity视图时,使用@SessionAttributes("")注解出现Cannot expose session attribute 'user' because of an existing model object of the same name异常问题 错误原因: 因为request  session默认是不会加入velicity context中

ytp151730的专栏 4210

velocity模板引擎学习(2)-velocity tools 2.0

使用velocity后,原来的很多标签无法使用了,必须借助velocity tools来完成,目前velocity tools最新版本是2.0,下面是velocity tools的一些注意事项: 1. 与Spring MVC3.x/4.x的集成问题 Spring 3.x/4.x只支持1.3.x的velocity tools,要使用2.0必须自己扩展VelocityToolboxView类 ...

weixin_30750335的博客 148
上一篇: IE中伪类:hover的使用及BUG,以及如何在IE6中进行修正(CSS)
下一篇: PicPick (图像捕捉/截图/处理)
subchen
博客等级 码龄25年 33粉丝 77原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值