struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Murray, Christopher" <>
Subject RE: <html:options> with an ActionForm
Date Thu, 31 Oct 2002 12:19:12 GMT
Isn't the action form is a bean on the request ?

If the list is wrapped in the action form then isn't this the same as your
last suggestion,

"Even better might be, to put your list into a bean and to put this bean
into request." ?

Have tried putting the list on the request but the page displays a blank
drop down list.

in the action :

request.setAttribute(MyActionForm, myForm);
request.setAttribute("customerNameList", myForm.getCustomerNameList());

in page:

<html:form method="post" action="/<blah blah blah>/MyAction">

<html:select property="customerId">

    <html:options collection="customerNameList" property="id"
labelProperty="name" />



Getting a blank drop down list.  


-----Original Message-----
From: Marcus Biel []
Sent: 31 October 2002 11:59
Subject: Re: <html:options> with an ActionForm

I guess you got just the same problem as I had.
1. I guess you misunderstood the way of ActionClass and ActionForm.

First of all, the ActionForm gets filled with the data the user types in
the input fields on your jsp. Then the action gets called.

So I bet putting your List into a Form won't help you, because you will
build it in your action.

You have to:
At the end of your action, write an request.setAtribute for your list.
Even better might be, to put your list into a bean and to put this bean
into request.

Then you should be able to use it.
You should carefully read:

Imho it's written quite tricky. I needed some time to fully understand
(I'm german, so it was even harder)
How to use the options tag depends wether your using a bean, a form, a

I got a Vector of Strings in a Bean, and I am not using the Form (I
doubt this could work)
Here's my solution:
<html:form action="" method="POST">
	<html:select property="plantSelection" size="1">
		<html:option value="%"><bean:message
		<html:options name="plantListBean" property="plantList"/>
	</html:select> <br>

hope this helps.

p.s: My Vector is build dynamically from database

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message