aspose file tools*
The moose likes Struts and the fly likes session and s:select Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "session and s:select" Watch "session and s:select" New topic
Author

session and s:select

John Eric Hamacher
Ranch Hand

Joined: Apr 25, 2007
Posts: 230
Hello:

I have a JSP page which is tabbed pane. Most of these panes submit a form and then forwards back to the same JSP. The consequence of this setup is that any given pane can have several points of entry.

I have many dropdowns and I need iterable things to populate them. I am having trouble being able to pick collections off the value stack because these collections must be stored at the session level. I know that the session is evil or something but this being the real world I have to use it. I cannot expose the collections in my Actions because so many of them lead to one place. So how do I use a <s:select list="???"> to use the session . . . or how do I put the collections on the value stack in such a way it mimics a session?

Hope this makes sense.

Thanks in advance.
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
I believe the syntax to use OGNL to get values from the session is list="#session.mySessionAttributeName".

I'm not a fan of using the session to store data that is relevant throught the user's session. I wouldn't say its evil, I just find that its more suceptible to introducing hard to diagnose bugs when users start using unexpected browser controls. Be careful to try to clean up the session data as best you can to try to limit these problems.
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 688

Hi..

Why you use session for list. If your jsp submit that jsp then call Action set your list value in Action then you not need to store your list in session.
you can directly use that list in your jsp.

When your Action is called your all Action variable push in to OGNL stack and you directly use this variable.After setting your list yo use

<s:select list="list" />


Thanks,
Nishan Patel.


Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: session and s:select