struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jiin-Her Lu" <J...@kcc.usda.gov>
Subject RE: html:options and html:select
Date Mon, 02 Feb 2004 14:29:30 GMT
If your list stores objects which is the type of Struts' LabelValueBean (provides only getValue()
and getLabel() methods), then you can simply as 

<html:select name="formBeanName" property="seletedValue">
	<html:options
		collection="collectionName" 
		value="value"
		labelProperty="label" />
</html:select>


Jiin-Her Lu
(816) 926-2145

>>> anant.parnami@wipro.com 02/02/04 06:31AM >>>

Hi Frank

Try using

Request.setAttribute("collectionName",list);

<html:select name="formBeanName" property="seletedValue">
	<html:options
		collection="collectionName" 
		value="id"
		labelProperty="name"
		name="com....CProduct"/>
</html:select>

I have tried putting the Collection as the request attribute never in
the form bean. One more thing make user you provide exact path of
CProduct in the name field.

Regards

Anant

-----Original Message-----
From: Otto, Frank [mailto:otto@delta-barth.de] 
Sent: Monday, February 02, 2004 5:41 PM
To: Struts-User (E-Mail)
Subject: html:options and html:select


hello,

I have following bean:

public class CProduct {

    private Integer id;

    private String name

    public Integer getId() {return id;}
    puclic void setId(Integer id){
...
}

My form class contains a java.util.List of CProduct bean.

How can I display the List as select box? I want to use the id as value
and the name as label of the select box.

For example:

<select name="ref">
    <option value="1">scanner</option>
    <option value="2">harddisk</option>
</select>

Has anyone an idea?

Regards,

Frank


Confidentiality Notice

The information contained in this electronic message and any attachments to this message are
intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information.
If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com
immediately
and destroy all copies of this message and any attachments.

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



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


Mime
View raw message