This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts select tag problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts select tag problem" Watch "Struts select tag problem" New topic
Author

Struts select tag problem

Devan Brahma
Ranch Hand

Joined: Jul 07, 2009
Posts: 46

hi,
i'm having a problem with the struts select tag.
the problem is that i'm not getting the key value
this is my code
<s:select list="couList" listKey="couid" headerKey="-1" headerValue="-Select-" name="misc.Country" onchange="countrychange()"></s:select>
in the list i provide the names
and in the listkey i provide the ids ...
now what i want is to get the id corresponding to the selected value..
please help


->R§H<-
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

Can you please clarify a bit what is in couList. Is it a list of some type of POJO class?? If yes, then can you please post the relevant code of that...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
vishwa venkat
Ranch Hand

Joined: Nov 22, 2003
Posts: 185
you should use select in this fashion-

<s:select list="couList" listKey="couid" listValue="couName" headerKey="-1" headerValue="-Select-" onchange="countrychange()"></s:select>
assuming couList is a list of Country Object having couid,couName as properties.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts select tag problem
 
Similar Threads
populate items using struts2 <s:select>
How to retain value in struts 2 using <s:select></s:select> tag
Struts
Using Struts 2 Select Tag for dynamic values
Populating subsequent select boxes with DWR