You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Barry Volpe <st...@childrencare.com> on 2003/10/30 00:39:34 UTC
Using a form for a view
Okay I create a form to collect information
and store it in a database.
<form-bean name="cityForm"
type="org.apache.struts.validator.DynaValidatorForm" >
<form-property
name="type"
type="java.lang.String"
initial=""/>
<form-property
name="state"
type="java.lang.String"
initial=""/>
<form-property
name="city"
type="java.lang.String"
initial=""/>
<form-property
name="cities"
type="java.util.ArrayList"/>
</form-bean>
request.setAttribute(mapping.getAttribute() ,cityForm);
Now I want to query the database for this information.
Do I create another form (I will have multiple results)
and knowing I have multiple result sets use the same form
but change all type="java.lang.String" to type="java.util.ArrayList"/>?
request.setAttribute(mapping.getAttribute() ,cityViewForm);
I guess this is somewhat of a newbie question but
How do you normally get the query results of an action
passed to the fowarded jps where I will use jstl to print results.
I'm not talking about populating a form I know how to do this
using forms.
What is practiced for a view?
Do I use a collection? What do I do specifically?
Thanks,
Barry
Re: Using a form for a view
Posted by Barry Volpe <st...@childrencare.com>.
Question answered. Found a good example in
Mastering Jakarta Struts.
----- Original Message -----
From: "Barry Volpe" <st...@childrencare.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, October 29, 2003 3:39 PM
Subject: Using a form for a view
Okay I create a form to collect information
and store it in a database.
<form-bean name="cityForm"
type="org.apache.struts.validator.DynaValidatorForm" >
<form-property
name="type"
type="java.lang.String"
initial=""/>
<form-property
name="state"
type="java.lang.String"
initial=""/>
<form-property
name="city"
type="java.lang.String"
initial=""/>
<form-property
name="cities"
type="java.util.ArrayList"/>
</form-bean>
request.setAttribute(mapping.getAttribute() ,cityForm);
Now I want to query the database for this information.
Do I create another form (I will have multiple results)
and knowing I have multiple result sets use the same form
but change all type="java.lang.String" to type="java.util.ArrayList"/>?
request.setAttribute(mapping.getAttribute() ,cityViewForm);
I guess this is somewhat of a newbie question but
How do you normally get the query results of an action
passed to the fowarded jps where I will use jstl to print results.
I'm not talking about populating a form I know how to do this
using forms.
What is practiced for a view?
Do I use a collection? What do I do specifically?
Thanks,
Barry
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org