• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help regarding s:select tag list

 
Venkata Sirish
Ranch Hand
Posts: 112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This is Venkat. Iam new to struts2 framework. Iam struck up with a small problem using <s:select> tag.

I have a page which contains a select tag . on page load i will populate its list values from server. Its a search form. when i perform the search the results are displayed in the same page.

In the action class, iam using the String member to get the selected value.

but after displaying the results in the same page, iam unable to get s:select tag list data....

how can i maintain the s:select list data,

To be specific, can i get the <s:select> tag list values in action class ....

please help me ASAP,

Thanks in Advance,
Venkat
 
Marimuthu Madasamy
Ranch Hand
Posts: 72
Java Monad Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page load the list is available because it is in the request scope i guess. So when the page is displayed first, the select tag is populated with the list object in request scope. When you click for search results, it is a new request. So When you forward the results, you need to again make the list available in the request scope.
If you want to avoid making the list available for each request, you can use session scope for the list (make sure that the list in session doesnt contain stale data). This way when you load the page first time you make the list available for entire session. So the list now will be available in search results page.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic