You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Zhang, Larry (L.)" <lz...@ford.com> on 2004/12/20 16:58:22 UTC
Actionform 's property
Say I have an action form
MyForm extends ActionForm {
List employeeList;
//set/getter follows...
}
Suppose in my action class's execute method,
I populated employeeList from database, and do
myForm.setEmployeeList(List someData);
Now in my Jsp, how to get this value and assign this value to a java
script variable?
Such as:
In my jsp:
<% List iWantToGetThisList = ??? %>
I know one way is that in the action's execute method, I put the
employeeList in the request using request.setAttribute("employeeList",
employeeList); but I don't want to do this way...
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Actionform 's property
Posted by Daniel Perry <d....@netcase.co.uk>.
Well the way you dont wish to use would be the normal way to do it :)
The form will be available in the request or session (depending on where you
put the form) scope from the jsp under the form's name. So
${formName.employeeList} is the list from a JSTL perspective. From
scriptlet, either:
=((full.package.name.MyForm)request.getAttribute("formName")).getElmployeeLi
st();
or
=((full.package.name.MyForm)session.getAttribute("formName")).getElmployeeLi
st();
Daniel.
> -----Original Message-----
> From: Zhang, Larry (L.) [mailto:lzhang20@ford.com]
> Sent: 20 December 2004 15:58
> To: Struts Users Mailing List
> Subject: Actionform 's property
>
>
> Say I have an action form
>
> MyForm extends ActionForm {
> List employeeList;
> //set/getter follows...
> }
>
> Suppose in my action class's execute method,
> I populated employeeList from database, and do
> myForm.setEmployeeList(List someData);
>
> Now in my Jsp, how to get this value and assign this value to a java
> script variable?
>
> Such as:
>
> In my jsp:
>
> <% List iWantToGetThisList = ??? %>
>
> I know one way is that in the action's execute method, I put the
> employeeList in the request using request.setAttribute("employeeList",
> employeeList); but I don't want to do this way...
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org