JavaRanch Home    
 
This page:         last edited 22 February 2010         What's Changed?         Edit

Struts1 Faq   

This page contains Frequently Asked Questions relating to Struts 1

  1. How can I learn Struts? (link)
    • What tutorials are available? (link)
    • What books are available? (link)
  2. Where can I find an example of a Struts Application? (link)
  3. How do I set a default value for an html:select tag? (SelectDefaultValue)
  4. How do I include the right JavaScript .js files when I'm using Tiles?(TilesJavaScript)
  5. How can I keep from adding a duplicate record to the database or ordering a duplicate product if the user submits the form a second time by mistake? (HowToPreventMultipleFormSubmits)
  6. I have an ArrayList of JavaBeans in my ActionForm and would like my JSP to display a table that has input fields for each bean in the list. How do I do that in Struts? (IndexedProperties)
  7. How do I access a database in my Struts Application? (StrutsDataSource)
  8. How do I set up Eclipse for Struts development? (StrutsAndEclipse)
  9. When I submit a form, I'm getting the error Cannot create bean of class com.mycompany.MyForm What's wrong? (CannotCreateBean)
  10. When I submit a form, I'm getting the error Exception thrown : javax.servlet.ServletException: BeanUtils.populate What's wrong? (PopulateError)
  11. When I try to display a Struts JSP, I get the error java.lang.NullPointerException: Module 'null' not found What's wrong? (ModuleNull)
  12. When I try to display a Struts JSP, I get the error Cannot find ActionMappings or ActionFormBeans collection What's wrong? (NoActionMappings)
  13. I'm using IndexedProperties in my JSP, and I'm getting the error java.lang.IllegalArgumentException: Property myProperty is not indexed What's wrong? (PropertyNotIndexed)
  14. I'm using Tiles in my application, and it worked before, but since I upgraded to Struts 1.3.x it stopped working. What's wrong? (Tiles13Upgrade)
  15. Is there a way to get Struts to reload the message resources files without restarting the server or the application? (ReloadMessageResources)
  16. I'm trying to generate Struts tags dynamically in a scriptlet, but it doesn't seem to work. What's wrong? (StrutsTagsInScriptlets)
  17. I've got a JSP with a select tag and options generated from a database that I put in request scope. It works fine if there are no errors, but if Struts validation returns to the input page because of a validation error, the collection of options is no longer there. How can I solve this problem? (RefreshValuesOnValidationError)
  18. How do I upload files using Struts? See http://wiki.apache.org/struts/StrutsFileUpload



  How can I learn Struts?

Start by checking out what is available at the Struts Home Page . This site has links to a lot of good information about Struts. Then check out the Struts Wiki. This page has a wealth of good information about struts

When you're first starting out, though, it's much better to learn by trying it out than poring over a bunch of reference materials.

  Tutorials

If you want to start out just using your favorite text editor, the Struts Wiki Tutorials Page has the best listing of free tutorials.

If you're going to be using an IDE, such as Eclipse or NetBeans, you're in luck. Struts is popular enough and has been around long enough that most IDEs now have some sort of Struts support. When you're learning, it's a good idea to search for a Struts tutorial that is geared toward your particular IDE. Try Googling "Struts Tutorial xxx" where xxx is the name of your favorite IDE.

Here are some simple flash tutorials on creating a Struts application with WebSphere Studio WSAD and Struts

  Books

While it's true that there's a lot of good reference material on the Struts Home Page, a book written by a professional author can provide a much more organized, concise, and clear picture of the framework.

Here are some good books on Struts:

For a more complete list, see the Struts Wiki Books Page.

Also check out the JavaRanch Bunkhouse J2EE book list for some reviews of Struts books.



  Where can I find an example of a Struts Application?

The first place to start is with the material you received when you downloaded Struts. When you unzip the file, there is a webapps directory. In this directory, you will find the struts-examples.war file. Deploy this war file to your app server and run it. Then look at the source code for it. That should give you a good idea of some of the things you can do in Struts, and how it all works.

You may say, "Yes, I've looked at that, but it's really just a toy application that doesn't do anything important. I want an example of a real application that was built using Struts." If you want real applications, you can download several from this page on SourceForge. The Beer4All application on that page is a good example of a shopping cart application using Struts.



This page compiled and edited by Merrill Higginson

StrutsFaq

JavaRanchContact us — Copyright © 1998-2014 Paul Wheaton