Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JSP to Servlet

Status
Not open for further replies.

dexter195

Programmer
Jun 18, 2003
220
EU
Hi,

i have all my jsp pages created and the servlet versions compiled. i was wondering if there's an easy way to use the servlet .class files instead of the jsp files.

i.e. when the "Pages/CreateAdmin.jsp" page is requested in the browser the "CreateAdmin_jsp.class" file is used instead.

ive had a look round but ive found no ways of doing this.

thanks for the help
 
Thats what Tomcat does though - the first tome your JSP is requested, it is compiled into a servlet class, which from then on is called - so your JSP is only compiled once ...

--------------------------------------------------
Free Database Connection Pooling Software
 
sorry for late reply.

ive tried removing the jsp files however when they're removed im told they dont exist even though the class files exist for the jsp files.

any thoughts as to why this is happening?

thanks for your help

 
The JSP pages get translated to servlets and compiled on-the-fly when they are first requested or they are updated. They need to remain on the web server along with the generated servlets.

Tim
---------------------------
"Your morbid fear of losing,
destroys the lives you're using." - Ozzy
 
Why are you removing the JSPs ? Just leave them on there ...

--------------------------------------------------
Free Database Connection Pooling Software
 
so is there no way at all that i can remove them so that my source code is kept out of harms way? and just use the servlet class files?
 
the reason i want to remove the jsp's is because the server wont be located in our offices. we will be distributing the code to sit on the customers server.
 
I wouldn't worry about that - decompiling java byte code (ie the .class files) is so easy its emabarassing.

[don't take this the wrong way]

In any case, is your JSP groundbreaking stuff that no-one could reproduce or write themselves ? Are you really that bothered if someone manages to hack your server and look at your JSP ?

I believe it is possible to precompile the JSPs using JSPC, but I've never done it - have a google. Here is one link :


--------------------------------------------------
Free Database Connection Pooling Software
 
thats very true about the decompiling but it's "prefered" unfortunitly that i have to have the code in class files. ive used the ant jspc to compile the jsp files.

i wont be able to test this for at least a week or two but would it be possible to install the tomcat server on a pc with only the java runtime (so it cannot attempt to compile the jsp, and barf if they arnt there) and just use the class files as you said above? would i even need the jsp files at all on the server then?

thanks again for your help
 
cheers sedj.

thanks again for your help.

for anyone wondering how to compile the jsp using ant go to the "Web Application Compilation" right under the "Production Configuration" and the script is there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top