• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Set the value in html:select tag

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have store the value in action class session scope.
I want to show that value in jsp drop down box.
I am using the following format.

<sLogic:iterate name="interCompanyRent" id="interCompany">
<TR>
<TD align="right"><layout:label>Rem Div:</layout:label></TD>
<TD>
<rem:select property="divisionId" value='<bean:write name="interCompany" property="divisionId"/>' onchange="retriveData(this.value)">
<html:option value="">-- Select Division --</html:option>
<html:options collection="all_division_list" property="id" labelProperty="label" />
</rem:select>
</TD>
</sLogic:iterate>

i am setting the value in the value attribute of rem:select tag.
but i am not able to set the vale.
In the loop i have adde two text box. That is working fine.

Can anybody tell me how to do that.

Thanks,
Achyut
 
Achyut Behera
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have checked that the value is empty means it is not able to retrive.
Can any body tell me how to set the value, if not this way any other way.

Thanks,
Achyut
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't nest custom tags like that. One solution would be to use the container's JSP EL if it's JSP 2+.
 
Achyut Behera
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you please tell me, Using struts tag how i will set the value into drop down box.
Or Using EL how to set.

Please send me the code, so that i can do it.

Thanks,
Achyut
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure what a "rem:select" tag does. If it's your own custom tag, I can't help you.

However, the html:select tag will auomatically set the selected option to the value that you specify in the property attribute. So, all you have to do is set the ActionForm bean's property to the right value, and the correct option will be displayed. For more details, see question 3 of our FAQ.
 
Achyut Behera
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you are correct. but i have used property name 'divisonId' as an array in formbean class.
I am using two select box having same property name.
That' why i am not able to set in the select box.
rem:select is same as html:select.

What i am doing is, i am storing the divisonId into a bean class. and add into a list and store into the session.
in the jsp page i am going to iterate.

problem is i am not able to set the value through iterarion into the select box.

Can you please help me out.

Thanks,
Achyut
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
instead of that use logic:present

like

<html:select name="sform" property="course" styleId="course" >
<logic:present scope="session" name="alist" >
<html:options collection="alist" name="CourseForm"
labelName="c_name" property="c_name" labelProperty="c_name"/>
</logic:present>
</html:select>
 
rk palleru
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try with above code . you can get the correct result
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To use EL you can either use a JSP 2+ container (any modern app server) or the HTML EL tags:Please use code tags and disable HTML when posting code.

@rk: Your <html:select> tag doesn't include a "value" attribute, so cannot address the OP's question.
 
Achyut Behera
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As per yours,
I have used EL tags. It is not coming.

Any other way to define.

Thanks,
Achyut
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If there's a bean stored under the "interCompany" key in app, session, request, or page scope, and it has a property called "divisionId" then either JSP EL or the EL tags will work: if it's not, then it's likely something else is wrong.
 
Achyut Behera
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my application i am not using JSP 2.x.

Is there any other way to set the value.

Thanks,
Achyut
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use the HTML-EL tags.
 
Your buns are mine! But you can have this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic