This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Thanks for your reply It will be great if you clarify one more doubt that do we need to define bean usig bean tags of struts or bean tag of jsps <jsp:useBean> shall be preferred or <bean efine name=myBean scope=request> should suffice
Thanks in advance
Joined: Feb 15, 2005
Just put the bean in a scope. This would normally be done in an action class prior to forwarding to the page.
in your Action class:
MyBean myBean = new MyBean(); myBean.setFoo("whatever"); request.setAttribute("myBean", myBean);
In this example, you don't need either a <jsp:useBean> or a <bean:define> The bean has alread been put in request scope by the action.
If you want to put the bean in scope in the JSP itself, you can do that with either a <jsp:usebean> or a <bean:define> tag. Either will work, just take your choice. Once the bean is in a scope, the <html:link> tag will find it.
Example: The following would call a link with ?parm1=foo.