This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
All jsp's will convert to (servlet) java code on calling jsp in a folder called 'work' which is present in tomcat root folder. Is it what you wanted. Else post back with more detail regarding the problem -arun
Part of the JSP spec is to implement jsp precompilation from a URL: http://host/app/page.jsp?jsp_precompile=true -- maybe you can create a script that will run that URL for you -- or some app server vendors provide a .bat file that will run precompilation, maybe you can create an ant script that will call that bat file for you...
Originally posted by Sridhar Raman: What i wanted to know is using Ant you can compile java files, jar it war it create ear and also deploy it. but is there a way to use ant script and compile jsp code also
Not built into it natively, no. Because JSP Precompilation is vendor dependent -- the resultant java servlet will have the vendor's code written in it, so Ant can't do it itself.
Yes, you can use the jspc task in ant to precompile your jsp files into .java files. You can also postcompile those .java files into .class files. Read this link: http://ant.apache.org/manual/OptionalTasks/jspc.html However, I'll warn you that jspc will create the proper directory structure including subdirectories, but it doesn't put subdirectory information into the .java package declaration. Everything is stuffed into a single package. This means that if you have maindir/subdir1/index.jsp and maindir/subdir2/index.jsp, you'll end up with 2 index_jsp.java files which BOTH have package maindir. subdir1 and subdir2 won't be put into the package name. If anyone knows how to get around this, please shout!
Hi, For security purpose, I have tried many time to make a pre-compile of JSP to be able to remove all *.jsp file leaving only *.class files. But I never made it work. I am using Tomcat 4.1.xx and it automaticaly compile everything in the work folder. All jsp file is translate in java in an "org.apach.jsp package", even if the jsp page is in a sub-folder of the root. The problem about the ANT jspc is that it translate the page in another package bellow the "org.apache.jsp" one. I think that is a reason why tomcat cannot find its JSP classes. The other problem I face is that I put all jsp in the WEB-INF/jsp folder because I use Struts and I dont want my jsp page to be see directly (only via a Controller Servlet see MVC). The jspc compiler will put all my jsp in the org.apache.jsp.WEB_0002dINF.jsp folder... this doesn't help I guess. ANY CLUE ANYONE ? See : ANT JSPC to have more info
Welcome to the Ranch Dave P! You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it. Thanks! bear JSP Fourm Bartender