Following the thread concerning Struts/JB5 I thought that I should chuck in
my own thoughts - JB5 is great for debugging but - boy does it take some
effort to set up - I am sure that there must be a simpler way of getting it
all to hang together but here's my technique:
1 File|NewProject
Project Wizard step 1
Project name "strutsconfig" or whaterver you want
Project for defaults "(Default project)"
Root path "C:/jbuilder5/jakarta-tomcat-3.2.1/webapps" does not have to be
this but I think it is useful to be able to test project outside of JBuilder
and this is the default JB install structure
Project directory name "strutsconfig" - JBuilder will do this for you.
Source Directory name "WEF-INF/src"
Backup Directory name "WEB-INF/bak"
Document directory name "WEB-INF/doc"
Output directory name "WEB-INF/classes"
Check Project directory is parent to source and output directories.
Project Wizard step 2
Add struts.jar to Required Libraries (you have got the struts download
havn't you).
If you have not already configured the struts library you can do this later
and add the library through the project properties dialogue.
Project Wizard step 3
whatever you want
Finish
2 File|New Class
The only reason for using the class wizard at this point is to create the
directory stucture under
"C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/strutsconfig"
Just create any class - Untitled1 will do nicely - you can delete it later.
Use your usual package names eg: com.foo.struts.strutsconfig
Uncheck all the options.
OK
3 Project|Make Project "strutsconfig" - whatever you called your project
4 Switch to Explorer and browse to:
"C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/strutsconfig
If everything has gone according to plan you should have the following
directory structure:
\strutsconfig
+WEB-INF
+classes
| +com
| +foo
| +struts
| +strutsconfig
+src
+com
+foo
+struts
+strutsconfig
5 Add a new folder named "lib" under /strutsconfig/WEB-INF
strutsconfig
+-WEB-INF
+classes
| +com
| +foo
| +struts
| +strutsconfig
|
+src
| +com
| +foo
| +struts
| +strutsconfig
+lib
6 From the struts distribution, copy struts.jar into
/strutsconfig/WEB-INF/lib
7 From the struts distribution, copy the various .tld files you will be
referencing into /strutsconfig/WEB-INF for the sake of this demo copy at
least struts-bean.tld and struts-html.tld
8 Back to JBuilder
File|New|Web Application
Name "strutsconfig"
Directory "C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/strutsconfig
Check the Generate WAR box
OK
9 struts-config.xml goes in \strutsconfig\WEB-INF directory
web.xml goes in \strutsconfig\WEB-INF directory
resouce.properties file goes in
\strutsconfig\WEB-INF\classes\com\foo\.... and make sure it is correctly
referenced in the web.xml file!!
.tld's go in \strutsconfig\WEB-INF directory
.jsp go in root (or path from) \strutsconfig
10 This is the fun part
Now you have your basic struts app - just a couple of jsp's and you are
ready to run
Use Project|Make project
Then "Web Run your chosen .jsp
In the messages view you will doubtless get lots of info but the first
line should be somthing like:
C:\jbuilder5\jdk1.3\bin\javaw -classpath
"C:\jbuilder5\jakarta-tomcat-3.2.1\lib\webserver.jar;C:\jbuilder5\jakarta-to
mcat-3.2.1\lib\jasper.jar;C:\jbuilder5\jakarta-tomcat-3.2.1\lib\parser.jar;C
:\jbuilder5\jakarta-tomcat-3.2.1\lib\jaxp.jar;C:\jbuilder5\jakarta-tomcat-3.
2.1\lib\servlet.jar;C:\jbuilder5\extras\jakarta-struts-1.0\lib\struts.jar;C:
\jbuilder5\lib\webserverglue.jar;C:\jbuilder5\extras\jakarta-struts-1.0\lib\
struts.jar;C:\jbuilder5\extras\jakarta-struts-1.0\lib\jdbc2_0-stdext.jar;C:\
jbuilder5\jakarta-tomcat-3.2.1\lib\servlet.jar;C:\jbuilder5\extras\ecs-1.4.1
\ecs-1.4.1.jar;C:\jbuilder5\extras\ecs-1.4.1\lib\jakarta-regexp-1.2.jar;C:\j
builder5\extras\ecs-1.4.1\lib\xerces-1.2.2.jar;C:\jbuilder5\lib\jdsserver.ja
r;C:\jbuilder5\lib\beandt.jar;C:\jbuilder5\lib\dx.jar;C:\jbuilder5\jdk1.3\de
mo\jfc\Java2D\Java2Demo.jar;C:\jbuilder5\jdk1.3\jre\lib\i18n.jar;C:\jbuilder
5\jdk1.3\jre\lib\jaws.jar;C:\jbuilder5\jdk1.3\jre\lib\rt.jar;C:\jbuilder5\jd
k1.3\jre\lib\sunrsasign.jar;C:\jbuilder5\jdk1.3\lib\dt.jar;C:\jbuilder5\jdk1
.3\lib\tools.jar" org.apache.tomcat.startup.Tomcat -config
C:\jbuilder5\jakarta-tomcat-3.2.1\webapps\opsdemo3\conf\server8080.xml
(horrid isn't it)
Further down the messages you should have somthing like:
Classpath according to the Servlet Engine is:
C:\jbuilder5\jakarta-tomcat-3.2.1\webapps\opsdemo3\WEB-INF\classes;C:\jbuild
er5\jakarta-tomcat-3.2.1\webapps\opsdemo3\WEB-INF\lib\struts.jar;C:\jbuilder
5\jakarta-tomcat-3.2.1\webapps\opsdemo3\WEB-INF\lib\ecs-1.4.1.jar;C:\jbuilde
r5\jakarta-tomcat-3.2.1\webapps\opsdemo3\WEB-INF\lib\jdbc2_0-stdext.jar
Copy the two pieces of text into a text editor and splice them together
taking the second message from C:\jbuilder5 .. to the end and placing this
just after -classpath " in the first message - add a ';' to separate from
the rest of the classpath.
Delete the opening "C:\jbuilder5\jdk1.3\bin\javaw " and everything after
the closing '"' (that is get rid of "org.apache.....r8080.xml" )
You should be left with somthing like:
-classpath
"C:\jbuilder5\jakarta-tomcat-3.2.1\webapps\opsdemo3\WEB-INF\classes;C:\jbuil
der5\jakarta-tomcat-3.2.1\webapps\opsdemo3\WEB-INF\lib\struts.jar;C:\jbuilde
r5\jakarta-tomcat-3.2.1\webapps\opsdemo3\WEB-INF\lib\ecs-1.4.1.jar;C:\jbuild
er5\jakarta-tomcat-3.2.1\webapps\opsdemo3\WEB-INF\lib\jdbc2_0-stdext.jar;C:\
jbuilder5\jakarta-tomcat-3.2.1\lib\webserver.jar;C:\jbuilder5\jakarta-tomcat
-3.2.1\lib\jasper.jar;C:\jbuilder5\jakarta-tomcat-3.2.1\lib\parser.jar;C:\jb
uilder5\jakarta-tomcat-3.2.1\lib\jaxp.jar;C:\jbuilder5\jakarta-tomcat-3.2.1\
lib\servlet.jar;C:\jbuilder5\extras\jakarta-struts-1.0\lib\struts.jar;C:\jbu
ilder5\lib\webserverglue.jar;C:\jbuilder5\extras\jakarta-struts-1.0\lib\stru
ts.jar;C:\jbuilder5\extras\jakarta-struts-1.0\lib\jdbc2_0-stdext.jar;C:\jbui
lder5\jakarta-tomcat-3.2.1\lib\servlet.jar;C:\jbuilder5\extras\ecs-1.4.1\ecs
-1.4.1.jar;C:\jbuilder5\extras\ecs-1.4.1\lib\jakarta-regexp-1.2.jar;C:\jbuil
der5\extras\ecs-1.4.1\lib\xerces-1.2.2.jar;C:\jbuilder5\lib\jdsserver.jar;C:
\jbuilder5\lib\beandt.jar;C:\jbuilder5\lib\dx.jar;C:\jbuilder5\jdk1.3\demo\j
fc\Java2D\Java2Demo.jar;C:\jbuilder5\jdk1.3\jre\lib\i18n.jar;C:\jbuilder5\jd
k1.3\jre\lib\jaws.jar;C:\jbuilder5\jdk1.3\jre\lib\rt.jar;C:\jbuilder5\jdk1.3
\jre\lib\sunrsasign.jar;C:\jbuilder5\jdk1.3\lib\dt.jar;C:\jbuilder5\jdk1.3\l
ib\tools.jar"
Now copy all of this (take care not to include and new line characters)
into Project|Project properties|Run|VM parameters.
11 Try to debug - if it's all OK you will be able to debug within JBuilder5
Try to launch Tomcat on its own that should work too with this
configuration.
12 Tear out hair if you ever use Project|Rebuild project because JBuilder5
will trash the project by deleting the \lib directory and the
resource.properties file - don't ask me why
Good luck
PS if anyone is brave enough to check out all the above and find my
mistakes - please post me the corrections!!!!
David
E-Mail : [EMAIL PROTECTED]
Web : http://www.bolsover.com