struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anders Hermansen <>
Subject Re: Access to the form bean from jsp?
Date Sat, 27 Sep 2003 17:11:21 GMT
* Bjørn T Johansen ( wrote:
> I need to access the form from my jsp page, but I can't seem to find a
> way to do this.. I need a name of the form to access but what is the
> name of the form instance that Struts generate? If I have a form named
> LoginForm does Struts make an instance called loginForm or does it
> choose a random name or?

You specify the name when you declare a form bean in struts-config.xml

in example:
  <form-bean name="LoginForm" type="" />

In the jsp you can define a variable to point to this form using:
  <bean:define id="myLoginForm" name="LoginForm" type="" />
you can then use myLoginForm in any scriptlet.

You can also easily extract specific properties:
  <bean:define id="theUsername" name="LoginForm" property="username"/>

or you can print them directly:
  <bean:write name="LoginForm" property="username"/>

This is all from memory, so I hope it's correct.

Hope this helps,

Anders Hermansen
YoYo Mobile as

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

View raw message