Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP Compilation

 
Praveen Dharmavaram
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a lot of JSP's which include other JSP's. I am trying to use the JSP compiler which comes with WebSphere 5.0. The JSP's wont compile and generate errors. When I dont compile and just have the servlet compile them at runtime, they compile without errors. Can Some one help me?


For Ex:-

test.jsp
--------
<html>
<%
String abc = "abc"
%>

<%@ include file="test1.jsp" %>

</html>

test1.jsp
---------
<P> This is a test <%out.print(abc);%></P>
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34410
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Praveen,
WSAD tries to look for compiler errors in the JSP as if it were standalone. At runtime, it uses the includes which results in a full pages.

A few ways around this:
1) Use the .jspf (jsp fragment) extension for the JSPs that go within a page. [I haven't tried this, but is should work]
2) Pass the variables are parameters or request scope attributes to avoid the compilation issue completely.
3) Turn off JSP validation. JSPs often flag errors falsely. You need to determine if there is extra value in having these things flagged or if you can just catch them when running the JSP.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic