• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:include using jsp_precompile question

 
michael warren
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I was hoping to create a precompile.JSP that would precompile all other JSPs,
based on using the jsp:include action something like this:-

When I try this is seems to ignore the jsp_precompile parameter, and the output from test.jsp gets included in the output of precompile.jsp
I know there are ant scripts that will precompile JSPs, but I'm not familiar with ant and thought that this would be an easy solution.

Should it work, or am I missing something obvious?
[ March 04, 2004: Message edited by: michael warren ]
[ March 04, 2004: Message edited by: michael warren ]
[ March 04, 2004: Message edited by: michael warren ]
 
David Valentine
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is an ant task to do page precompiling for Tomcat.
Also useful for general development, if it does not compile, no use hitting the webserver
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you are using <jsp:include> action page will be compiled (if not already compiled) no matter what parameters are you sending.
 
michael warren
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your answers, I know there are ant scripts that will precompile JSPs. I also know that <jsp:include> will result in included page being compiled if not already compiled, but I don't want the output of the jsp included, just for it to be compiled.
Since I know I can use ant scripts to do what I want I suppose its academic, but I would still like to understand why sending the jsp_precompile parameter when using <jsp:include> doesn't seem to have any effect.
Just to explain, JSPs can be "precompiled" using the jsp_precompile parameter as below, resulting in no output if the page is compiled OK. I was hoping to create a JSP page that would locate all other JSPs in its directory and sub-directories and compile them, displaying a list of any pages that have errors. I'm just about to start learning about ant, but liked the idea of being able to have a standard JSP that would work without needing the ant or anything other than a standard JSP container to work.
 
Peter Lg
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the sake of completeness I'm posting what I think is a work-around / solution to this problem. My experiments seem successful.

Not sure why jsp:include does not properly post the dynamic request parameter but if it's a bonafide request parameter then everything works. Unfortunately this precludes using a JSP to do the inclusions.

If you create a servlet (EG: JspPrecompile) and call it using the jsp_precompile=true parameter then you can include the jsp's you wish to pre-compile. This works even if the jsp is in a protected part of the app.

PSEUDO-CODE...
IF 'jsp_precompile=true' parameter is present
THEN include the desired jsp's you wish to compile
ELSE send redirect to self + ?jsp_precompile=true

Caveat: Make sure you include the 'no-cache' directives / headers.

Cheers,
Pete
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Peter Lg",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic