Hi Paul, To specify a path for your compilation results use the -d option like so:
jspc.sh -compile -d /jakarta-tomcat-5.0.25/webapps myapp/WEB-INF/classes ...the rest of you compile options... It will build any subdirs required using the directory you specify, along with the package name you give it (org.apache.jsp if you don't specify a package name) as the root directory for any subdirs. As for the work directory that is where Tomcat places any jsps that it has to compile (i.e. non-precompiled jsps) during runtime. If you run Tomcat with uncompiled jsps and walk though your app in a browser you will see compiled JSPs appear in the work directory. It will create subdirs, etc. to mimic your applications directory structure and place compiled versions there. You could just place your compiled jsps in the same respective places in the work directory before starting Tomcat and it would probably work. BUT, Tomcat will only expand .war files into the webapps directory so you have no way of packaging up these compiled files from the work directory and automatically expanding them into another work directory at Tomcat startup. That would have to be a manual process by the end user (or an install script). It is not the recommended deployment strategy. It does save you from having to worry about having the web.xml mappings correct though. Tomcat will check first in the work directory for a compiled jsp and then look for an uncompiled version if it doesn't find one there. No mappings in web.xml are required. In answer to another related question I saw posted: If you precompile your JSPs and then remove the original JSPs you need to have two things for your app to run: 1. The compiled JSP class files need to be copied over to the WEB-INF/classes directory with the correct directory structure. (The exact directory with be the package name (org.apache.jsp by default) plus any subdirs the JSP existed in under you apps root folder. i.e. if under webapps/yourapp you had a jsp in a directory subdir1/subdirB then under you WEB-INF/classes directory you would need a directory called org/apache/jsp/subdir1/subdirB and you would place that compiled JSP class there. The easiest way to do this is to run your compile with the -d option as stated above and point the output to your WEB-INF/classes directory. jspc in Tomcat 5.x should automatically create the correct subdir structure and place the class file in it. 2. Yuo need servlet definitions and mappings that tell Tomcat "If someone requests this .jsp execute this servlet instead". These go in the web.xml file for your app. jspc will create a complete file or just a fragment file that contains all the mappings. You can tell it explicitly to create a fragment file with the -webinc option like so: -webinc /jakarta-tomcat-5.0.25/webapps/myapp/WEB-INF/my_web_fragment.xml I think it creates a complete web.xml if you use this option -webxml /jakarta-tomcat-5.0.25/webapps/myapp/WEB-INF/my_complete_web.xml In this case you just have to rename the file web.xml and place it in you app's WEB-INF directory. If you don't do BOTH of these things, then Tomcat won't know where to look for your compiled JSPs and will instead look for the actual .jsp. Finding nothing it will throw a 404 error. I hope this is helpful. Jason --- Paul Wallace <[EMAIL PROTECTED]> wrote: > (sorry, wrong key!) > > Hi Jason, > Thanks for that. Yes, it does make sense. A couple > of things > though, I just ran it with -compile - great. But my > query about the work > directory and was more towards what I am being > 'encouraged' to do from > the powers that be. I.e not WAR the app., but put it > in the work > directory. Is this ill-advised/poor practice? > To accomplish this, is it as simple as dragging the > compiled > source under my work directory, and modifying my > web.xml as advised? > Why does -compile work, but not appear in the > usage?! > Also, can I specify a path for the compilation, > rather than the > classes be placed in the same dirs as the source? (I > tried adding a path > after the -compile switch, but it constructed and > compiled a file with > the same name as the class directory destination). > > Do I make sense?! > > Paul. > > Paul, > > I just use the -compile option and have jspc do the > compilation from .java to .class for me. It seems > to > work fairly well. Once all the fully compiled (ie > .class) files are placed in you applications > WEB-INF/classes directory you just need to place the > generated web.xml file in WEB-INF. There is an > option > to create a complete web.xml file that you can place > in WEB-INF or, if you already have a web.xml file > you > want to keep, you can have jspc create an xml > fragment > that just contains the servlet definitions and > mappings that you then add (in the appropriate > place) > to your existing web.xml. Then just war up you > application directory in the normal way (you can > even > delete the jsps once your certain the servlet > mappings > are working). > If you try to put the generated files in your > working directory you won't be able to war them up > and > deploy them in the normal "put war file under > webapps > directory and tomcat will expand it when it starts" > way. You'd have to ship a complete tomcat directory > structure with the work directory already filled in > with your compiled jsps. Does that make sense? > > Jason > > --- Paul Wallace <[EMAIL PROTECTED]> wrote: > > Hello, > > I have compiled my JSPs thus: > > > > jspc -webapp C:\src\site -d C:\src\site\classes -s > > -l -uriroot > > C:\src\site > > > > this builds the Java source files to the specified > > location, but how > > might I deploy them? > > > > What is a typical deployment after a JSP > > compilation? Compilation of > > Java source files, then WAR/JAR? Can I not define > > the JSP compile to go > > under my work directory? > > > > The purpose of my efforts is to try and speed up / > > make TC less memory > > consumptive. > > > > cheers > > > > Paul. > > > > > > > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Mail Address AutoComplete - You start. We > finish. > http://promotions.yahoo.com/new_mail > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __________________________________ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
