Struts Section Index | Page 9
Does an Action have to return an ActionForwarding?
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
Does Struts work with a secure SSL connection?
Yes. Once SSL is installed for your container, the Struts custom tags and Action Mappings will automatically insert the
correct references so that all the page and image links operate in SSL mode.more
How can I initialize custom "application scope" objects for use in a Struts application?
One way would be to subclass the ActionServlet, to to initialize whatever application scope objects you might need. Just
remember to call the super.init() method!
A better approach would be to wr...more
How can Struts check for a set of global conditions before processing an action?
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
How can you tell if a form bean was automatically created?
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
How do I authenticate users with Struts?
You can use either container-based security or form-based security to authenticate users. With container-based security,
the Web browser will track the logins for you, and "replay" the c...more
How do I install SSL for my container?
See:
installing the Sun Secure Socket extension
keytool
and the documentation for your container.
Here are some common configuration mistakes:
When installing standard extensions, install them...more
How do I install Struts?
To develop applications with Struts, you can usually just add the Struts JAR file to your Java development environment. You can then start using the Struts classes as part of your ow...more
How do I switch to SSL mode for logon, and then back again for the rest of the session?
This is still harder than it should be, but here's the drill:
The bad news is that you need to hardcode the schema to switch from standard to SSL mode and back again. The good news is that
you ca...more
In my Action subclass, rather than returning the results of mapping.findForward(...) I need to forward to a page determined at runtime. What is the *proper* way to forward to xxx.jsp? Should I construct an ActionForward? (tried that unsuccessfully).
You can create a new ActionForward dynamically:
String path = ... create context-relative path to new page ...
return (new ActionForward(path));
The path you calculate must be context relative a...more
Is Struts compatible with other Java technologies?
Yes. Struts is committed to supporting industry standards. Our lead developer is a member of JSR052, Sun's Expert group for developing a
standard library of custom JSP tags. A primary design...more
Reset for validation
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
When do I need "struts.jar" on my classpath?
When you are compiling an application that uses the Struts classes, you must have the "struts.jar" on the
classpath your compiler sees -- it does not have to be on your CLASSPATH enviro...more
Where can I get help with Struts?
The Struts package comes complete with a users guide
to introduce people to the framework and its underlying technologies. Various components also have their own in-depth developers
guide, to cov...more
Where I can I get a copy of Struts?
The best place to download Struts is at jakarta.apache.org/struts. The
nightly builds are very stable, and recommended as the best place to start today.more