struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bjørn T Johansen <...@havleik.no>
Subject Re: Access to the form bean from jsp?
Date Sat, 27 Sep 2003 17:15:54 GMT
Yes, you are absolutely correct; it uses the name I defined in
struts-config, I should have known...

Thanks.... :)


BTJ

On Sat, 2003-09-27 at 19:11, Anders Hermansen wrote:
> * Bjørn T Johansen (btj@havleik.no) 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="com.company.forms.LoginForm" />
> 
> In the jsp you can define a variable to point to this form using:
>   <bean:define id="myLoginForm" name="LoginForm" type="com.company.forms.LoginForm"
/>
> 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
> 
> --
> Anders Hermansen
> YoYo Mobile as
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message