You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Nanduri, Amarnath" <Am...@Agilquest.com> on 2001/04/13 20:19:24 UTC

select option jsp exception

I am getting the following exception :

<Apr 13, 2001 2:18:06 PM EDT> <Error> <HTTP>
<[WebAppServletContext(1629209,onboard.presentation.master
ServletException
javax.servlet.jsp.JspException: Cannot create iterator for
com.agilquest.onboard.struts.master.actionForm
c5f
        at
org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:355)
        at
org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:231)
        at jsp_servlet._updateprofile._jspService(_updateprofile.java:706)
        at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:208)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:244)
        at
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp
l.java:149)


I am updating my profile. 
I have bean A which contains the state i am in. I have an other bean which
has the list of all states . Call it Bean B

When the user initially comes to this page i have to show the state as
"Virginia" in a select list.
The user can modify the state to say "alabama" 
When the user submits information i want the 'state' variable to be set to
'alabama' instead of 'virginia'.


  Is this feasible ?  Will this work ?

   <html:select name="aBean" property="state" size="1" >
        <html:options name="bBean" labelName="states"/>
   </html:select> 
 
 class A  //session scope bean
 {
  private  String  state  = "virginia" ;

  public String  getState()
  {
    return  state ;
  } 

  public  void  setState(String value)
  {
    state  =  value  ;
  }

 }


  class B   // application scope bean
  {
    private  ArrayList  states  = new ArrayList() ;

    public B()
    {
      states.add("alabama");
      states.add("Missisippi");
      states.add("Tenesse");
      states.add("virginia" ) ;
      states.add("Vermount" ;

    }


    public  Iterator  getStates()
    {
       return  states.iterator() ;
    }

  }





-----Original Message-----
From: Nanduri, Amarnath [mailto:Amarnath.Nanduri@Agilquest.com]
Sent: Friday, April 13, 2001 1:22 PM
To: 'struts-user@jakarta.apache.org'
Subject: select option



Hi all,

  How do i implement the <SELECT> option using struts. I want to be able to
show a drop-down list from which the user can select what he/she wants. The
struts-test war file comes with a <html:select> example. this example shows
the whole list instead of in a drop down list. I need a drop down list. any
suggestions are appreciated. Thanks.

cheers,
Amar..