Hi Rick,
I am using Struts 1.2. Unless Struts 1.3 provides something special on this
aspect,
following is my understanding :
a) If you have a bean that is NOT an actionForm, then you HAVE TO explicitly
put it in request scope using request.setAttribute("mybean",mybean);
to access it in the jsp
However, if the bean was actually an ActionForm and was mentioned in any
actionMapping (in struts-config.xml)
under "name" attribute, it would go in the scope mentioned by "scope"
attribute (session scope by default)
- this would happen without you have to write any java code in Action class
for doing this.
Now if I wanted to make the bean available beyond request scope
b) that you can do using the following code snippet
HttpSession session = request.getSession();
session.setAttribute("mybean",mybean);
Can someone please confirm (a) above.
hope that helps,
robin
---------
On 11/3/06, Rick Schumeyer <[EMAIL PROTECTED]> wrote:
I'm trying to understand how and when beans are available within struts.
(1.3.5)
For example, if my Action class contains code like:
MyBean mybean = new MyBean() // NOT an ActionForm, just a regular bean
I would have thought (and the docs suggest) that I would need something
like
request.setAttribute("mybean", mybean);
in order to use this bean in the jsp that the action eventually forwards
to. But I don't...the bean seems to automatically be available to the
jsp.
Now if I wanted to make the bean available beyond request scope, then
would I need to use the request.setAttribute?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]