This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Accessing values from session  RSS feed

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys..!
I just need to get an array of values from action class to jsp page through session..
i set the array to session by using the following code..

Map session = ActionContext.getContext().getSession();
session.put("array",s); //where s is an array

I can access it in the action classes by using the following code,

Map session = ActionContext.getContext().getSession();
String s1[]=(String[])session.get("array");

But my problem is i need to access that array in JSP page..!
so please post me a reply for fixing my problem soon..!
 
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suggestion : use sessionAware interface to get the session object it's best practice.
 
Rajaprabhu Aravindasamy
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah its working but guys i need to access the whole array in the jsp page..!
something like..

<% String s[]=%><s:property value="#session.array[]"/><% ; %>

I know it is wrong, but i need a solution similar to this..!
please post it soon...!
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use SessionAware interface in your action class set a list in session
---------------------------------------------
List<String> list = new ArrayList<String>();
list.add("pp");
list.add("pp1");
list.add("pp2");
getSession().put("accList", list);
---------------------------------------
Dipslay in this way in your jsp
-----------------------------------------
<s:iterator value="%{#session.accList}" >
<s:property />
</s:iterator>

-------------------------------
 
Hey! Wanna see my flashlight? It looks like this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!