Struts2 - Retrieves a session object using another session object as a key

I am new to struts2 and I am trying to get a session object using a dynamic session key.

My application stream looks like this: user will hit an action from their browser

http://localhost:8080/prjcr/pad.action?userid=p02585@test.org 

In the action class, I get a list of values ​​from the web service using the request parameter p02585@test.org and save them in the session as follows:

//get the request parameter
userid=ServletActionContext.getRequest().getParameter("userid);    
QDefn[] qDefn = proxy.getQDefns(userid); //webservice call   
List<QDefn> qdList = new ArrayList<QDefn>();   
qdList.add(Arrays.asList(qDefn));  

Retrieve a portion of a user from a query parameter that will be used as a session key

userid = userid.substring("UserId", userid.substring(0, userid.indexof('@'));   
//The key itself is what we receive in the request parameter  
ActionContext.getContext().getSession().put("UserId", userid);      

and then move the linked list of values ​​to the session

ActionContext.getContext().getSession().put(userid, qdList);  

and navigate to the JSP that displays this list in the drop-down list as follows:

<s:select name="qdefn" 
id="qdefn" 

list="#session.%{#session.UserId}"  ---What is the notation here??

listKey="defnName"
listValue="defnName"
headerKey="ALLQD"
headerValue="All" > </s:select>  

qdList jsp, , . java session.get(userid). OGNL. , , Struts2/OGNL.

+3
1

System.out.println(ActionContext.getContext().getSession().getClass());

"class org.apache.struts2.dispatcher.SessionMap",

out.println(session.getClass());

jsp " org.apache.catalina.session.StandardSessionFacade" - ( tomcat)

session.getAttribute(userid);

session.get(userid);
0

All Articles