You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Buics <rb...@pc.ntep.nec.co.jp> on 2003/02/22 04:08:01 UTC

html select problem, help me please

I have a collection named code1data, in logic:iterate it works fine, but when I
apply this to html:select it goes wrong.
Anybody could help me in html:select tag.

here's my script ..

<TABLE><tbody>
<logic:iterate id="mydata" collection="<%=code1data %>">
    <tr>
      <td >&nbsp;</td>
      <td>
       &nbsp;<bean:write name="mydata" property="cd"/>
      </td>
      <td >
       &nbsp;<bean:write name="mydata" property="descrip"/>
      </td>
     </tr>
 </logic:iterate>
 </tbody>
</TABLE>


<html:select property="classification" size="1">
    <html:options collection="<%=code1data %>"  property="cd"
labelProperty="descrip"/>
</html:select>






--
It's good to be slow and steady; but it's better to be fast and reliable.



Struts Menu Problem

Posted by Arunachalam Jaisankar <js...@xtra.co.nz>.
Hi All,

I'm using struts menu and dhtmlExpandable.jsp. And it is working fine. But
i'm facing one problem.
I'm using frames. And the menu jsp is left frame. And I want all other pages
shoud open in right side.
When I specify the target as below in menu-config.xml file, it is not
opening in right side. It opens in left side.
How to solve this?

Looking for help.

menu-config.xml

    <Menu  name="TableSetupMenu"   title="Tables Setup">
         <Item  name="CDevent"    title="Event">
               <Item   name="CDEvent"    title="Event Cause"
image="images/party-add.png" location="EventCause.jsp" target="right"/>
         </Item>
    </Menu>

regards
Jai



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


Re: html select problem, help me please

Posted by Buics <rb...@pc.ntep.nec.co.jp>.
Here's where I got my collection.

<jsp:useBean id="stockbean" class="chemical.ChStocknoBean" scope="session"/>
<jsp:useBean id="code1mst" class="codemst.Code1mstBean" scope="session"/>
<jsp:useBean id="code2mst" class="codemst.Code2mstBean" scope="session"/>

<%
String stockno = request.getParameter("chemical.stockno");
String username = request.getParameter("chemical.approved_by");
stockbean.chkStockno(stockno);

Collection code1data = code1mst.getDatabyFieldName("CHEMICAL CLASS");
Collection code2data = code2mst.getDatabyFieldName("CHEMICAL STORE");

%>



Ray Madigan wrote:

> How did you get the collection in your jsp page.  Did you create it there,
> or did you bring it in from your ActionForm.
>
> If you would create a get/set on your FormBean and place it in the FormBean
> in your Action object, then you can get it from the form bean with the
> collection attribute in select.
>
> If you want I can outline the code to do this.
>
> Thanks
> Ray Madigan
> -----Original Message-----
> From: Buics [mailto:rbuico@pc.ntep.nec.co.jp]
> Sent: Saturday, February 22, 2003 8:04 PM
> To: Struts Users Mailing List
> Subject: Re: html select problem, help me please
>
> It gives me no choice Ray, I'll have to do it in the dirty way.
> Well first timer, so thats it.
>
> <html:select property="chemical.classification" >
>         <%
>   Iterator i = code1data.iterator();
>   Hashtable data = new Hashtable();
>   while (i.hasNext())
>   {
>   data = (Hashtable) i.next();
>   String cd = (String) data.get("cd");
>   String descrip =(String) data.get("descrip");
>   out.println("<option value=\"" + cd + "\">" + descrip );
>   }
>          out.println("</option>");
>      %>
>  </html:select>
>
> Thank you for your time Ray.
>
> --buics
>
> Ray Madigan wrote:
>
> > This has confused me too - I think that <html:options use of collection
> > is different from <logic:iterate use of collection
> >
> > in the <html:options case it is a string that names the attribute that
> > holds the collection.
> >
> > in the <logic:iterate case collection is the real class that you want to
> > iterate.  If you want to use <html:options you should put the collection
> > into a session or request attribute.
> >
> > -----Original Message-----
> > From: Buics [mailto:rbuico@pc.ntep.nec.co.jp]
> > Sent: Friday, February 21, 2003 7:08 PM
> > To: Struts Users Mailing List
> > Subject: html select problem, help me please
> >
> > I have a collection named code1data, in logic:iterate it works fine, but
> > when I
> > apply this to html:select it goes wrong.
> > Anybody could help me in html:select tag.
> >
> > here's my script ..
> >
> > <TABLE><tbody>
> > <logic:iterate id="mydata" collection="<%=code1data %>">
> >     <tr>
> >       <td >&nbsp;</td>
> >       <td>
> >        &nbsp;<bean:write name="mydata" property="cd"/>
> >       </td>
> >       <td >
> >        &nbsp;<bean:write name="mydata" property="descrip"/>
> >       </td>
> >      </tr>
> >  </logic:iterate>
> >  </tbody>
> > </TABLE>
> >
> > <html:select property="classification" size="1">
> >     <html:options collection="<%=code1data %>"  property="cd"
> > labelProperty="descrip"/>
> > </html:select>
> >
> > --
> > It's good to be slow and steady; but it's better to be fast and reliable.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
> --
> It's good to be slow and steady; but it's better to be fast and reliable.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org

--
It's good to be slow and steady; but it's better to be fast and reliable.



RE: html select problem, help me please

Posted by Ray Madigan <ra...@madigans.org>.
How did you get the collection in your jsp page.  Did you create it there,
or did you bring it in from your ActionForm.

If you would create a get/set on your FormBean and place it in the FormBean
in your Action object, then you can get it from the form bean with the
collection attribute in select.

If you want I can outline the code to do this.

Thanks
Ray Madigan
-----Original Message-----
From: Buics [mailto:rbuico@pc.ntep.nec.co.jp]
Sent: Saturday, February 22, 2003 8:04 PM
To: Struts Users Mailing List
Subject: Re: html select problem, help me please


It gives me no choice Ray, I'll have to do it in the dirty way.
Well first timer, so thats it.

<html:select property="chemical.classification" >
        <%
  Iterator i = code1data.iterator();
  Hashtable data = new Hashtable();
  while (i.hasNext())
  {
  data = (Hashtable) i.next();
  String cd = (String) data.get("cd");
  String descrip =(String) data.get("descrip");
  out.println("<option value=\"" + cd + "\">" + descrip );
  }
         out.println("</option>");
     %>
 </html:select>

Thank you for your time Ray.

--buics


Ray Madigan wrote:

> This has confused me too - I think that <html:options use of collection
> is different from <logic:iterate use of collection
>
> in the <html:options case it is a string that names the attribute that
> holds the collection.
>
> in the <logic:iterate case collection is the real class that you want to
> iterate.  If you want to use <html:options you should put the collection
> into a session or request attribute.
>
> -----Original Message-----
> From: Buics [mailto:rbuico@pc.ntep.nec.co.jp]
> Sent: Friday, February 21, 2003 7:08 PM
> To: Struts Users Mailing List
> Subject: html select problem, help me please
>
> I have a collection named code1data, in logic:iterate it works fine, but
> when I
> apply this to html:select it goes wrong.
> Anybody could help me in html:select tag.
>
> here's my script ..
>
> <TABLE><tbody>
> <logic:iterate id="mydata" collection="<%=code1data %>">
>     <tr>
>       <td >&nbsp;</td>
>       <td>
>        &nbsp;<bean:write name="mydata" property="cd"/>
>       </td>
>       <td >
>        &nbsp;<bean:write name="mydata" property="descrip"/>
>       </td>
>      </tr>
>  </logic:iterate>
>  </tbody>
> </TABLE>
>
> <html:select property="classification" size="1">
>     <html:options collection="<%=code1data %>"  property="cd"
> labelProperty="descrip"/>
> </html:select>
>
> --
> It's good to be slow and steady; but it's better to be fast and reliable.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org

--
It's good to be slow and steady; but it's better to be fast and reliable.




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


Re: html select problem, help me please

Posted by Buics <rb...@pc.ntep.nec.co.jp>.
It gives me no choice Ray, I'll have to do it in the dirty way.
Well first timer, so thats it.

<html:select property="chemical.classification" >
        <%
  Iterator i = code1data.iterator();
  Hashtable data = new Hashtable();
  while (i.hasNext())
  {
  data = (Hashtable) i.next();
  String cd = (String) data.get("cd");
  String descrip =(String) data.get("descrip");
  out.println("<option value=\"" + cd + "\">" + descrip );
  }
         out.println("</option>");
     %>
 </html:select>

Thank you for your time Ray.

--buics


Ray Madigan wrote:

> This has confused me too - I think that <html:options use of collection
> is different from <logic:iterate use of collection
>
> in the <html:options case it is a string that names the attribute that
> holds the collection.
>
> in the <logic:iterate case collection is the real class that you want to
> iterate.  If you want to use <html:options you should put the collection
> into a session or request attribute.
>
> -----Original Message-----
> From: Buics [mailto:rbuico@pc.ntep.nec.co.jp]
> Sent: Friday, February 21, 2003 7:08 PM
> To: Struts Users Mailing List
> Subject: html select problem, help me please
>
> I have a collection named code1data, in logic:iterate it works fine, but
> when I
> apply this to html:select it goes wrong.
> Anybody could help me in html:select tag.
>
> here's my script ..
>
> <TABLE><tbody>
> <logic:iterate id="mydata" collection="<%=code1data %>">
>     <tr>
>       <td >&nbsp;</td>
>       <td>
>        &nbsp;<bean:write name="mydata" property="cd"/>
>       </td>
>       <td >
>        &nbsp;<bean:write name="mydata" property="descrip"/>
>       </td>
>      </tr>
>  </logic:iterate>
>  </tbody>
> </TABLE>
>
> <html:select property="classification" size="1">
>     <html:options collection="<%=code1data %>"  property="cd"
> labelProperty="descrip"/>
> </html:select>
>
> --
> It's good to be slow and steady; but it's better to be fast and reliable.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org

--
It's good to be slow and steady; but it's better to be fast and reliable.



RE: html select problem, help me please

Posted by Ray Madigan <ra...@madigans.org>.
This has confused me too - I think that <html:options use of collection
is different from <logic:iterate use of collection

in the <html:options case it is a string that names the attribute that
holds the collection.

in the <logic:iterate case collection is the real class that you want to
iterate.  If you want to use <html:options you should put the collection
into a session or request attribute.

-----Original Message-----
From: Buics [mailto:rbuico@pc.ntep.nec.co.jp]
Sent: Friday, February 21, 2003 7:08 PM
To: Struts Users Mailing List
Subject: html select problem, help me please


I have a collection named code1data, in logic:iterate it works fine, but
when I
apply this to html:select it goes wrong.
Anybody could help me in html:select tag.

here's my script ..

<TABLE><tbody>
<logic:iterate id="mydata" collection="<%=code1data %>">
    <tr>
      <td >&nbsp;</td>
      <td>
       &nbsp;<bean:write name="mydata" property="cd"/>
      </td>
      <td >
       &nbsp;<bean:write name="mydata" property="descrip"/>
      </td>
     </tr>
 </logic:iterate>
 </tbody>
</TABLE>


<html:select property="classification" size="1">
    <html:options collection="<%=code1data %>"  property="cd"
labelProperty="descrip"/>
</html:select>






--
It's good to be slow and steady; but it's better to be fast and reliable.




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