File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes This could bug you Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "This could bug you" Watch "This could bug you" New topic
Author

This could bug you

Garry Kalra
Ranch Hand

Joined: May 25, 2001
Posts: 111
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

Joined: Jun 03, 2000
Posts: 5040

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

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Bhupinder Dhillon
Ranch Hand

Joined: Oct 12, 2000
Posts: 124
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

Joined: May 25, 2001
Posts: 111
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: This could bug you
 
Similar Threads
forwarding the page
What's this parseException
Strings n Scriplet
Multiple forms in a single JSP page
Servlet -Download Jar file