Can I just create some of my JavaBeans in the JSP using a scriptlet?
Struts is designed to encourage a Model 2/MVC architecture. But there is nothing that prevents you from using Model 1 techniques in your JavaServer Pages, so the answer to the question is “Yes, you can”. Though, using Model 1 techniques in a Struts application does go against the grain. The approach recommended by most Struts developers is to create and populate whatever objects the view may need in the Action, and then forward these through the request. Some objects may also be created and stored in the session or application context, depending on how they are used. Likewise, there is nothing to prevent you from using scriptlets along with JSP tags in your pages. Though, many Struts developers report writing very complex scriplet-free applications and recommend the JSP tag approach to others. For help with Model 1 techniques and scriptlets, you might consider joining the Javasoft JSP-interest mailing list, where there are more people still using these approaches.
Related Questions
- NetVision NPM uses JavaServer Pages (or JSP ) to create reports, this sounds complex and too sophisticated for me. Do I need to learn JSP to use NetVision NPM?
- Can the Enterprise JavaBeans I create be used with any EJB-compliant application server?
- How to pass Javascript variable value into JSP scriptlet?