• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

struts html list drop down question

 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a question based on same thing.
I have a list drop down for 3 elements.

I have html code as:
<!--<SELECT name=select2>
<OPTION selected>Start With</OPTION>
<OPTION>Equal To</OPTION>
<OPTION>Contain</OPTION></SELECT>-->

<INPUT value=123 name=textfield22242232>

and a text field next to it. How do i write this in struts html tags? How to write these in the AForm.java class.
I have defined getter setter methods separately for this text field but i don't know how to define one for this list drop down. Please let me know.thanks.
 
Liz Brown
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<html:select name="whatever">
<html ptions collection="sList" property="planDrop" labelProperty="planDrop" />
</html:select>

i found above in struts manual.
However, I am not sure how to put the getter setter method in MyForm.
Could anyone help?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Liz,
Use the property attribute instead of the name attribute in your struts select tag. Name specifies the name of the bean to look in for values. Property specifies the form field (and therefore getters/setters) to map to.

If your three items are always the same, it may be overkill to put them in a List. Instead try:


or if you have different names and values:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic