Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

This could bug you

 
Garry Kalra
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing a unique problem, in the sense that i didn't thought
it was a problem as it used to work fine on tomcat 3.0, but on
tomcat 3.1, i'm getting a parseException by jasper.
The problem starts as follows:
I've got a config.jsp file as follows:
<%!
public static String site = "My Site";
%>
There's another file called display.jsp, defined as

The name of my site is <%= site %>
Value of flag is <%= flag %>

And finally a file called show.jsp defined as
<%@ include file="config.jsp" %>
<%
int flag = 0;
if (flag == 0) {
%>
<%@ include file="display.jsp" %>
<%
}
else if (flag == 1) {
%>
<%@ include file="display.jsp" %>
<%
}
else {
%>
<%@ include file="display.jsp" %>
<%
}
%>

The above code just illustrated my organization. Now when i try to
run show.jsp it fails with a parseException as follows:
org.apache.jasper.compiler.ParseException: Seen file \display.jsp already,
maybe this is a recursive include?!
Please guide me what should i do to prevent the above
Gaurav
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Gaurav:
I have seen your earlier post, but din't post what I thought.
Since no one else is taking a shot at this, I am saying this.
Personally, I would go into the work folder, open the java
source code and see if the java code correctly reflects
the if else construct. Not that this would be wrong, but
I would do it anyways. The reason I would do it is because
the error messsage is not very intutive.
If you find time try it out.
regds.
- satya
 
Bhupinder Dhillon
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Garry Kalra:

I've got a config.jsp file as follows:
<%!
public static String site = "My Site";
%>
There's another file called display.jsp, defined as

The name of my site is <%= site %>
Value of flag is <%= flag %>

How the heck do you expect to access 'site' variable )declared in config.jsp) from display.jsp??? It's like creating classes like these....

 
Garry Kalra
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks, everything is fine, i guess the only problem seems to be with tomcat 3.1, as i tried it out in tomcat 3.0 and tomcat 3.2.1 and it is working perfectly fine.
So i think the tomcat 3.1 is a pretty buggy software. Any views about tomcat 3.1 and tomcat 3.2.1 will be highly appreciated.
And for Bhupinder, it works fine because it is a compile time include.
Gaurav
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic