Struts Section Index | Page 8
How do I use Javascript to perform validation in Struts?
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
>Why aren't the Struts tags maintained as part of the Jakarta Taglibs project?
At first, it was to make it easier to develop the tags as the rest of the framework was developed. Placing the tags in
another repository would mean that we would have to be more careful about cha...more
Can we configure a separate log for each application?
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.
How can I set the locale for each individual user session before the first page displays? I've tried putting the session.setAtttribute(Action.Locale_key,<locale>) but it always displays in the default locale of the machine? Changing the machine locale causes the correct properties file to be used so I know that is not the problem.
In the Struts example app, this is done by including the following tag on the index.jsp page (actually, on every
page):
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:h...more
How can you prevent users from accessing a JSP directly that is designed to be used from an Action?
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
How do I use Javascript with my Struts forms?
The relevant HTML tags provide support for the Javascript event handlers onblur, onchange, onclick, ondblclick, onfocus,
onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmou...more
I have a simple question about localisation: If there is multiple users using the same localisation parameters : do they share a common ResourceBundle instance or do they have their own one. It seems to me that each user has his own ResourceBundle instance but does that affect the performance of the application.
The application's message resource bundles are shared across all of the users of a particular Struts-based web application.
The only thing that is unique to a particular user is the java.util.Loca...more
I usually need 'wrap="virtual"' as an attribute for my textareas. It isn't part of the HTML spec, but it's supported in both Netscape and IE, and it's pretty useful.
The Struts Action works through introspection. It doesn't know (or care) whether the value in a form was rendered by a Struts
custom tag or not. This means if you use a standard textarea tag in yo...more
Is it possible to combine dynamic Javascript menu systems with Struts?
The challenge with doing this is that the JSP tags run on the server (as the page is being generated), while the JavaScript
runs on the client side. To integrate the two, you need your tags (and o...more
Is the Struts object-orientated appropriate for small, heavily-loaded servers?
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
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
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
Why can't the Struts tags access the properties of my beans?
Struts uses JavaBeans Introspector to discover properties of beans. Introspector is pretty picky in the way it decides whether
something is a property or not. Specifically, it requires that ...more
Why is the form bean automatically created by both servlet and form tag?
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.