Meaningless Drivel is fun!*
The moose likes Struts and the fly likes using dropdown box html:options example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "using dropdown box html:options example" Watch "using dropdown box html:options example" New topic
Author

using dropdown box html:options example

ashish kulkarni
Ranch Hand

Joined: Aug 15, 2002
Posts: 130
Hi
Can some on provide a example of using <html ptions
in jsp,
how to define the in struts-config.xml file, how to
populate the data in Action class and then display it
on jsp page,
Also how to retain this data in request for other
request,
For example , suppose the user hits enter to submit
the data Action class which process the data, and if
there is any error, display back the jsp with the
error message, and all the values in dropdown box with
the value selected by user selected in option
I have seen the examples provided by struts, but it is
not clear how to use it with Action class
Ashish


A$HI$H
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
Here are some links that may help you starting:
  • Learn Struts' Form-Related Tags
  • Struts Tutorial
  • html options


  • ./pope


    blog - InfoQ.com
    ashish kulkarni
    Ranch Hand

    Joined: Aug 15, 2002
    Posts: 130
    Hi
    Thanx for the reply,
    suppose i have a class like this
    public class MyClass
    private String name;
    private String age;
    public String getName()
    {
    return name;
    }
    public String setName(String name)
    {
    this.name = name
    }

    public String getAge()
    {
    return age;
    }
    public String setAge(String age)
    {
    this.age= age
    }

    Can i use this, instead of org.apache.struts.util.LabelValueBean?
    Also i have defined a DynaValidatorForm
    <form-bean dynamic="true" name="VendorItemMappingForm" type="org.apache.struts.validator.DynaValidatorForm">
    <form-property name="vendorbean" type="java.util.ArrayList" />
    </form-bean>
    In my action class i pouplate vendorbean with MyClass,
    can i access it in my jsp
    I am bot able to do this


    Ashish
    Alexandru Popescu
    Ranch Hand

    Joined: Jul 12, 2004
    Posts: 995
    Yes I guess so.

    ./pope

    PS: i am not an user of struts
    Gregg Bolinger
    GenRocket Founder
    Ranch Hand

    Joined: Jul 11, 2001
    Posts: 15299
        
        6

    This might help you out.


    GenRocket - Experts at Building Test Data
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: using dropdown box html:options example