You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Sudip Kumar Bhattacharya(HOTPOP)" <sk...@HotPOP.com> on 2003/10/19 14:35:01 UTC

RE-POST: Access ActionForm data from JSP page

POSTING AGAIN.. 
Hi all,

I would like to get some fields in my jsp page from the ActionForm and
display them as simple text in my web page.

The idea is like when the user logs into the system, his username, location
and address will be stored in some ActionForm and then on all the pages in
the system, the page header should display this information.

This Page Header is a tile and is not a part of the Form tag.

What is the best way to fetch data from the ActionForm in this type of a
case?


Regards,
Sudip



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


Re: RE-POST: Access ActionForm data from JSP page

Posted by Mark Lowe <ma...@talk21.com>.
You may have taken the trouble to reflect on why there were no 
responses to your original post..

DynaActionForm theForm = (DynaActionForm) form;
Map formMap = theForm.getMap();

..or using beanutils...

Map formMap = BeanUtils.describe( theForm );
session.setAttribute("details",formMap);

...
//in your header

<bean:write name="details" property="username" />
or
<c:out value="${details.username}" />

This is a quick means of doing stuff.
..

If you've a UserBean or something.

UserBean user = new UserBean();
BeanUtils.copyProperties(user,theForm);
session.setAttribute("user",user);

<bean:write name="user" property="property" />
or
<c:out value="${user.property}" />

Cheers Mark


On Sunday, October 19, 2003, at 01:35 PM, Sudip Kumar 
Bhattacharya(HOTPOP) wrote:

> POSTING AGAIN..
> Hi all,
>
> I would like to get some fields in my jsp page from the ActionForm and
> display them as simple text in my web page.
>
> The idea is like when the user logs into the system, his username, 
> location
> and address will be stored in some ActionForm and then on all the 
> pages in
> the system, the page header should display this information.
>
> This Page Header is a tile and is not a part of the Form tag.
>
> What is the best way to fetch data from the ActionForm in this type of 
> a
> case?
>
>
> Regards,
> Sudip
>
>
>
> ---------------------------------------------------------------------
> 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