Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Default selection using Struts html:select tag

Reply
Thread Tools

Default selection using Struts html:select tag

 
 
Lucas White
Guest
Posts: n/a
 
      04-23-2004
Hi

I'm trying to default a combo box to select a default value when my
web page loads. The following code selects the index from the
indexList with index id 27 because I hard-coded it:

<html:select property="primaryIndexId" name="group" value="27">
<htmlption value="-1">&nbsp;</htmlption>
<htmlptions collection="indexList" property="indexId"
labelProperty="indexDesc" />
</html:select>

But when I try to soft code it to display the group's primary index,
it does not work:

<html:select property="primaryIndexId" name="group"
value="primaryIndex.indexId">
<htmlption value="-1">&nbsp;</htmlption>
<htmlptions collection="indexList" property="indexId"
labelProperty="indexDesc" />
</html:select>

Any help would be appreciated.
 
Reply With Quote
 
 
 
 
Yan Lijun
Guest
Posts: n/a
 
      04-28-2004
you need not to code like that
<html:select property="primaryIndexId" name="group"
value="primaryIndex.indexId">
<htmlption value="-1">&nbsp;</htmlption>
<htmlptions collection="indexList" property="indexId"
labelProperty="indexDesc" />
</html:select>

you simple only need to do is to set the property "primaryIndexId" in the
actionform to what you want it to be in the action servlet

23 Apr 2004 14:02:09 -0700 ʱ, http://www.velocityreviews.com/forums/(E-Mail Removed) (Lucas White) д:
--

>Hi
>
>I'm trying to default a combo box to select a default value when my
>web page loads. The following code selects the index from the
>indexList with index id 27 because I hard-coded it:
>
><html:select property="primaryIndexId" name="group" value="27">
> <htmlption value="-1">&nbsp;</htmlption>
> <htmlptions collection="indexList" property="indexId"
>labelProperty="indexDesc" />
></html:select>
>
>But when I try to soft code it to display the group's primary index,
>it does not work:
>
><html:select property="primaryIndexId" name="group"
>value="primaryIndex.indexId">
> <htmlption value="-1">&nbsp;</htmlption>
> <htmlptions collection="indexList" property="indexId"
>labelProperty="indexDesc" />
></html:select>
>
>Any help would be appreciated.


(E-Mail Removed)
/**
/* Java Is Not Platform-independent.It Is The Platform!
*/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple selection in jsp using struts Vasu Java 0 10-09-2006 01:21 PM
multiple selection in jsp using struts Vasu Java 2 10-09-2006 04:40 AM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
JTable with row selection, but no cell selection Simon Niederberger Java 2 01-07-2005 04:17 PM
struts tag inside a tag kishan bisht Java 1 07-08-2003 11:04 PM



Advertisments