Struts Section Index | Page 8
This often comes up in the context of authenticating users or with other control flow issues. The direct approach would be to subclass the ActionServlet controller servlet, and override a m...more
No. Sometimes, it might be better for an Action to handle the request itself. For example, you might need to return dynamic content that would be impossible or impractical to create with a JavaSe...more
There is a reset() method on ActionForm that is called *before* Struts does the auto-populate trick. The contract is that this method should reset all relevant attributes for this particular form...more
In general, you can define a special member variable in the bean that indicates that it has just been created. On a manual create you would reset that yourself, but on an auto create it would rema...more
It is valid for a user to enter the system either through the servlet or through the JSP form, and so the bean must be created in either place.
Using action classes as adapters and session EJBs for business logic sounds like a good way to go. Is also using EJBs as actionforms is a good idea because they are a good target for object reuse/
ActionForms are not designed for reuse with an EJB. In fact, early on, the ActionForm was changed from an interface to an abstract class to discourage this idea. The reasoning goes like this: An...more
Put those JSP pages in a directory under WEB-INF; for example, WEB-INF/jsp. Files under the WEB-INF directory cannot be directly accessed. Another approach is supported by the servlet API if you ...more
Is there is some kind of "j2ee compliant" way of doing user authentication and role-assignment - are there any standards one is supposed to use?
The J2EE recommendation for this is to use container-managed security (i.e. the <security-constraint> elements defined in web.xml) for user authentication and access control. Doing so mea...more
There is a restriction in Tomcat 3.2 related to how you declare log files. In Tomcat 4.0 this has been enhanced, letting you declare a separate destination for the servlet log per application, in...more
Does anyone know the performance difference between a direct method call andintrospection like Struts uses?
Independant performance engineers have benchmarked JDK 1.3 and the difference is now insignificant.
Compared to embedding the application logic in your servlet, Struts doesn't cost very much in terms of object creation. Struts only creates an instance of an Action class once, and then reuses it ...more
Under Netscape 4.7 for Windows, the html:form focus feature doesn't work properly. Is there a work around?
The problem is that the focus feature works all right at first, but when you press tab, it proceeds to the address bar, rather than the next field. After you tab around once, it starts working as...more
The best way is using David Winderfeldt's Struts validator servlet. This provides seamless client-side and server-side validation using regular expressions. Other than that, you can also attach o...more