session handling for request object in wicket framework(wicket 框架中请求对象的会话处理)
问题描述
1) 我在下面给出的请求对象中添加了一个元素,我需要在我的网页中获取/读取它,我该怎么做?
1) i have added an element in request object given below, i need to get/read this in my webpage, how can i do it?
<input type="hidden"> wicket:id="submitted" value="false" />
例如:在 servlet 中,使用隐藏会话中的 request.getParameter("submitted").
eg: in servlet, use request.getParameter("submitted") from hidden session.
2) 在我的控制器类中,我想在会话或隐藏字段中设置值,以便我可以识别用户是否已经处理了请求或进入了我的代码块.
2) in my controller class i want to set the value in session or hidden field, so that i can identify the user if he already processed the request or enetered my block of code.
推荐答案
1) 使用HiddenField
2) 使用自定义 WebSession 对象:
2) use a custom WebSession object:
public class MySession extends WebSession{
public Mysession(Request request){super(request);}
private boolean completedRegistration;
public boolean hasCompletedRegistration() {
return completedRegistration;
}
public void setCompletedRegistration(boolean completedRegistration) {
this.completedRegistration = completedRegistration;
}
}
这篇关于wicket 框架中请求对象的会话处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:wicket 框架中请求对象的会话处理
基础教程推荐
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
