beanGenerator V1.0

Wouldn't it be nice if, during the development of a Struts application, you can simply upload a Struts form 
coded using the Struts tag libraries and view it without updating the Struts configuration file and restarting the 
web container? 

Wouldn't it be even nicer if this tool can also generate the ActionForm class(es) from the form so that 
it/they can be used later for production? 

If your answer to these questions is yes, the Struts application I am presenting next should interest you.

More information on this application can be found on Dr. Dobbs' Journal's XXX issue.

Deployment
------------

This application has been developed and tested using Tomcat V4.1 on Windows NT/2000. To deploy
it in a similar environment, simply drop the WAR file in Tomcat's webapps directory.

After Tomcat created the beanGenerator subdirectory, edit the beanGenerator/temp/buildform.bat file
to define JAVA_HOME to point to the proper directory on your system.

To ue the application, point you browser to:
	http://localhost:portnumber/beanGenerator/

See the next section on possible issues and how to resolve them.

Issue	and Resolution:
--------------------

1) You uploaded JSP form uses tag libraries other than the Struts tag libraries	
Add the tag library to the application in the usual way. This includes copying the tag library jar file to 
this application's WEB-INF/lib directory, copying the library's tld file to WEB-INF, and add 
an <taglib> entry in the web.xml for the tag library.

2) You use the <bean:message> tag to output locale-specific messages.
The application displays the key if the associated message cannot be found in the application.properties file. 
You may either add the messages to the WEB-INF/classes/application.properties file for the application 
to display the intended message or leave it as is during development.

3)The web container does not seem to detect changes in JSPs and Java classes.	
On Tomcat:Change the server.xml file to add a DefaultContext sub-element to the main Service element 
and set the reloadable attribute to true. The easiest way to do this is to find the following comment: 
<!-- Define properties for each web application.  This is only needed if you want to set 
non-default properties, or have web application document roots in places other than the 
virtual host's appBase directory.  -->
And insert below it: 
	<DefaultContext reloadable="true"/> 
The default value for reloadable is true.

4) You get an error message telling you that Struts cannot find a certain setter method in the UserPageForm.	
This may occasionally happen due to the time lag between modifying the UserPageForm class 
(compiled as part of the UserPageAction processing) and the web container detecting the change and 
reloading the class. This is usually fixed by reloading the page.The number of seconds between checks 
for modified classes and resources, if reloadable has been set to true by default is 15 seconds. 
It is configured using the checkInterval attribute of the Loader element in the Tomcat server.xml file.

5) Another possibility is that JAVA_HOME in the /temp/buildform.bat file has not been defined or has 
been defined incorrectly. You have to add/modify the JAVA_HOME definition to point to the correct directory.

6) The web application does not work on non-Windows platforms.	
This application is written for the Windows platform. To run it on non-Windows platforms, you need to:	
- Modify the platform-specific string constants in Constants.java that define the path separator 
(\ in Windows and / in UNIX systems) and the name of the build script (buildform.bat for Windows 
and buildform.sh for UNIX systems) and recompile it using the Ant build file included. 
Entries have already been defined in the Constants.java file. All you need to do is to comment out the 
Windows-specific entries and remove the // in front of the UNIX entries and comment out the 
Windows-specific definitions.
-Write your own shell script named buildform.sh for compiling the UserPageForm.java. 
The content of your shell script should be quite similar to that of the Windows buildform.bat file. 

Andy Yuen  (andyyuen@kardinia.com)

August 2003.