session handling for request object in wicket framework

空扰寡人 提交于 2019-12-20 06:39:06

问题


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" />

eg: in servlet, use request.getParameter("submitted") from hidden session.

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:


1) use HiddenField

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;
    }
}



回答2:


I am not sure I have fully understood your questions.

But to make it short, if you want to get the value stored in your request object, you'll need to make the model of your input map to this value (by using HiddenField wicket internal class).

If you want to track your user, the best thing to do is looking around for a cookie set on the client side that'll allow you to manage its visits.

Please refine your question if you want a more precise answer...



来源:https://stackoverflow.com/questions/6174472/session-handling-for-request-object-in-wicket-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!