You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by lcl <lc...@gnireel.com> on 2003/06/04 11:33:02 UTC

html:options can not automatically match value

Hi all ,

I have using the following code to express a select control in html using
strtus tag:

<html:select property="projclieid">
  <html:options collection="com.nsk.gs.sales.ClientInfo"
labelProperty="cliename"
    property="clieid" />
</html:select>

When this jsp page is running, all is ok, but the options will not match
what the "projclieid" is. in the dropdown list, there is one item match the
value,but it is not mark as "selected", what's wrong?

And if I manually specific the value,such as <html:select
property="projclieid" value="aa">,
 it will work fine, it will more surprise me...

Please help me, thank you very much.
lcl




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: html:options can not automatically match value

Posted by lcl <lc...@gnireel.com>.
Sakis,

Thank you very much. I have done as you mentioned, but the result has not
changed.
I have tried to changed the collection name to
com_nsk_gs_sales_ClientInfo(of course, do it in action form to set a same
named attribute in session), and add a name attribute in html:selection tag
, which will like :
  <html:select name="project" property="projclieid" value="<bean:write
name='project' property='projclieid' filter='true'/>">
  <html:options collection="com_nsk_gs_sales_ClientInfo"
labelProperty="cliename" property="clieid" />
  </html:select>

the output html will like this :
<select name="projclieid">
  <option value="1">name1</option>
  <option value="10">name10</option>
  <option value="11">name11</option>
  ...................................<the more option will list herre>
</select>
but no one will be mark as "SELECTED" , WOW!

"Sakis Chatzinikolaou" <sh...@upatras.gr>
020501c32a7f$37876860$22918c96@sakis...
> Maybe you need to specify the name of the form bean before the
> property="projclieid"
> e.g.
> <html:select name="formbeanname" property="projclieid">
>
> and maybe the collection name should not be the
com.nsk.gs.sales.ClientInfo
>
> but the name you put in the request from the action class before you call
> the jsp
>
> <html:select name="apartmentForm" property="apartmentOffice">
>           <html:options collection="estateOfficesNames"
> property="estateOfficeID"  labelProperty="estateOfficeName" />
> </html:select>
>
> The estateOfficesNames is an attribute set in the request from the action
> class
> The apartmentForm  is the form bean and the apartmentOffice is a property
of
> the bean
>
> Hope this helps
>
> ----- Original Message -----
> From: "lcl" <lc...@gnireel.com>
> To: <st...@jakarta.apache.org>
> Sent: Wednesday, June 04, 2003 12:33 PM
> Subject: html:options can not automatically match value
>
>
> > Hi all ,
> >
> > I have using the following code to express a select control in html
using
> > strtus tag:
> >
> > <html:select property="projclieid">
> >   <html:options collection="com.nsk.gs.sales.ClientInfo"
> > labelProperty="cliename"
> >     property="clieid" />
> > </html:select>
> >
> > When this jsp page is running, all is ok, but the options will not match
> > what the "projclieid" is. in the dropdown list, there is one item match
> the
> > value,but it is not mark as "selected", what's wrong?
> >
> > And if I manually specific the value,such as <html:select
> > property="projclieid" value="aa">,
> >  it will work fine, it will more surprise me...
> >
> > Please help me, thank you very much.
> > lcl
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: html:options can not automatically match value

Posted by Sakis Chatzinikolaou <sh...@upatras.gr>.
Maybe you need to specify the name of the form bean before the
property="projclieid"
e.g.
<html:select name="formbeanname" property="projclieid">

and maybe the collection name should not be the com.nsk.gs.sales.ClientInfo

but the name you put in the request from the action class before you call
the jsp

<html:select name="apartmentForm" property="apartmentOffice">
          <html:options collection="estateOfficesNames"
property="estateOfficeID"  labelProperty="estateOfficeName" />
</html:select>

The estateOfficesNames is an attribute set in the request from the action
class
The apartmentForm  is the form bean and the apartmentOffice is a property of
the bean

Hope this helps

----- Original Message ----- 
From: "lcl" <lc...@gnireel.com>
To: <st...@jakarta.apache.org>
Sent: Wednesday, June 04, 2003 12:33 PM
Subject: html:options can not automatically match value


> Hi all ,
>
> I have using the following code to express a select control in html using
> strtus tag:
>
> <html:select property="projclieid">
>   <html:options collection="com.nsk.gs.sales.ClientInfo"
> labelProperty="cliename"
>     property="clieid" />
> </html:select>
>
> When this jsp page is running, all is ok, but the options will not match
> what the "projclieid" is. in the dropdown list, there is one item match
the
> value,but it is not mark as "selected", what's wrong?
>
> And if I manually specific the value,such as <html:select
> property="projclieid" value="aa">,
>  it will work fine, it will more surprise me...
>
> Please help me, thank you very much.
> lcl
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org