Struts Tutorials

11. 7 Best Practices of Struts

By: Emiley J. : 2008-08-13

Description: This tutorial lists 7 Best practices of Struts.


12. Origin and Architecture of Struts

By: Fanny Ong : 2007-10-12

Description: Craig McClanahan originally wrote the Struts framework, mostly while on his Memorial Day vacation in 2000! The framework was subsequently donated by Craig to the Apache Software Foundation. The fact that it was mostly written in one weekend should suggest to you that it’s a very simple framework.


13. ActionErrors and ActionError in Struts

By: Abinaya : 2007-10-01

Description: Struts request handling lifecycle as a happy day scenario is – from the point the user submits an html form till the user sees the next page. In reality, users of your web application may submit incorrect data or sometimes no data at all. You have to catch these as close to the user interface as possible, rather than waiting for the middle tier or the database to tell you that a column cannot be inserted in the database because it was expecting a non-null value. There are two consequences of such programming practice.


14. Tutorial on Struts Configuration File - struts-config.xml in Struts - from the book: Struts Survival Guide. Basics to Best Practices

By: Authors: Shenoy S. Mallya N. : 2007-10-01

Description: The configurable controller is the answer to the Fat controller problem. In a Fat Controller, the programmers can code “if” blocks on need basis. Not so with the configurable controllers. The expressive and configuration capability is limited to what the built-in controller can support. In Struts, the built-in controller supports a variety of cases that can arise while developing web applications. It even provides points to extend the configuration capabilities. These points known as Extension points, take the configurationcapability to the next dimension. In this tutorial, we will just look at the normal facilities offered by the strutsconfig.xml.


15. Handling multiple buttons in HTML Form in Struts

By: Charles : 2007-10-01

Description: You will frequently face situations where there are more than one or two buttons submitting the form. You would want to execute different code based on the buttons clicked. If you are thinking, “No problem. I will have different ActionMapping (and hence different Actions) for different buttons”, you are out of luck! Clicking any of the buttons in a HTML Form always submits the same Form, with the same URL. The Form submission URL is found in the action attribute of the form tag as:


16. ForwardAction in Struts

By: Daniel Malcolm : 2007-10-01

Description: ForwardAction is the one of the most frequently used built-in Action classes. The primary reason behind this is that ForwardAction allows you to adhere to MVC paradigm when designing JSP navigation. Most of the times you will perform some processing when you navigate from one page to another. In Struts, this processing is encapsulated in the Action instances. There are times however when all you want to do is navigate from one page to another without performing any processing. You would be tempted to add a hyperlink on the first page for direct navigation to the second. Watch out! In Model 2 paradigm, a straight JSP invocation from another JSP is discouraged, although not prohibited. For instance, suppose you want to go from PageA.jsp to PageB.jsp in your Struts application. The easy way of achieving this is to add a hyperlink in PageA.jsp as follows:


17. Protecting JSPs from direct access in Struts

By: Emiley J : 2007-10-01

Description: According to the Model 2 paradigm, the view is always served by the controller and should not be requested explicitly from any other view. In reality a JSP can always navigate to another JSP when the JSPs are placed anywhere in a WAR other than the WEB-INF directory (or its sub-directories). Similarly a user can type in the name of the JSP in the URL bar and invoke the JSP. The web application specification does not disallow such access. Actually this makes sense. The specification should not prevent anybody from coding using the Model 1 paradigm. Consequently your JSPs are exposed to the external world for nosy users to cause unnecessary problems, for hackers to exploit any vulnerability in the system. If you are wondering what the problem is with allowing direct access to JSPs, well, here are some.


18. IncludeAction in Struts

By: Fazal : 2007-10-01

Description: IncludeAction is much like ForwardAction except that the resulting resource is included in the HTTP response instead of being forwarded to. It is rarely used. Its only significant use is to integrate legacy applications with Struts transparently. Consider a web site that aggregates information from disparate sources – some of which are non-Struts. The JSP for such a web site consists of s to include different resources. One of such that might be as follows:


19. DispatchAction in Struts

By: Grenfel : 2007-10-01

Description: DispatchAction is another useful built-in Struts Action. However you cannot use it as is. You will have to extend it to provide your own implementation. An example will make things clear. Consider an online credit card application. Customers fill the credit card application online. The bank personnel get a List screen as shown in Figure below and they can act in one of four ways - Approve, Reject or Add Comment. Consequently there are three images each being a .


20. Handling Duplicate Form Submissions in Struts

By: Ivan Lim : 2007-10-01

Description: Duplicate form submissions are acceptable in some cases. Such scenarios are called idempotent transitions. When multiple submissions of data are not critical enough to impact the behavior of the application, duplicate form submissions do not pose a threat.