I need to store the username variable into session.
Map<String, Object> sessionname;
String uname="SomeValue";
public void setSession(Map map) {
sessionname=ActionContext.getContext().getSession();
sessionname.put("uname", username);//inserting String to the session variable
}
On another action page if I get this value back to a string then it shows null. Instead of giving string if I give string in double quotes it is getting on the action page.
String l=(String)session.getAttribute("uname");
System.out.println(l); //gives the value as null
If it is not possible give me another solution to pass a particular variable to other pages. I am developing an image sharing application using struts. In order to upload the image I need to pass the name of the user to the action page corresponding to the image uploading process.