• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with select tag in struts 2

 
pavan babu
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I have a drop down list which I have to construct dynamically.I am using struts2's s:select tag to display the dropdown list and I need to get the selected value and place it in the database.Here is the code snippets which I use




I tried with various combinations of <s:select> like

<s:select name="myBean.selectedValue" list="myBean.datemap" />

But no result I am able to display the list but not able to set the selected value from database say If I get the 2008 from database I am not able to set it to "2008".Similarly I am not able to retrieve the value from the drop down list when I submit the form.


My goal is when I submit I need to palce the value in the selectedValue property in myBean object.This king of new to me any help is apreciated.

--Pavan
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vs
 
pavan babu
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:vs


Hi

I am able to display the drop down from map but I am having problem retriving the the value selected.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That doesn't give you a compilation error?
 
pavan babu
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:That doesn't give you a compilation error?


no it doesn't I am able to display.But not able to get the selected value.
 
pavan babu
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pavan babu wrote:
David Newton wrote:That doesn't give you a compilation error?


no it doesn't I am able to display.But not able to get the selected value.



please ignore the small and capital letters.I typed the example.But the problem is with the select tag attributes
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic