jason101799
asked on
Include file problem!!
Experts,
I need advice from you guyz and gals. I have included the codes for your reference.
Test.jsp
--------
<%@ include file="chk_session.jsp" %>
<%@ page language="java" %>
<%@ page import="java.util.*, java.sql.*, javax.servlet.*, javax.servlet.http.*"
%>
<html> <head> <title>Verify User Profile</title> </head> <body> <center> <IMG SRC=/images/wsisupport/web shipping.g if height=100>
<HR> </center> </body>
</html>
-------------------------- ---------- ---------- ---------- --
chk_session.jsp
---------------
<%@ page language="java";
HttpSession session = request.getSession(true);% >
<%out.println("out=" + session.getMaxInactiveInte rval()/60) ;%>
-------------------------- ---------- ---------- ---------- --
I have included the chk_session.jsp page in my test.jsp page. But when I point to the test.jsp page, the out.println statement did not print out the session getMaxInactiveInterval. I wonder what went wrong, please advice.
Cheers
Jason
I need advice from you guyz and gals. I have included the codes for your reference.
Test.jsp
--------
<%@ include file="chk_session.jsp" %>
<%@ page language="java" %>
<%@ page import="java.util.*, java.sql.*, javax.servlet.*, javax.servlet.http.*"
%>
<html> <head> <title>Verify User Profile</title> </head> <body> <center> <IMG SRC=/images/wsisupport/web
<HR> </center> </body>
</html>
--------------------------
chk_session.jsp
---------------
<%@ page language="java";
HttpSession session = request.getSession(true);%
<%out.println("out=" + session.getMaxInactiveInte
--------------------------
I have included the chk_session.jsp page in my test.jsp page. But when I point to the test.jsp page, the out.println statement did not print out the session getMaxInactiveInterval. I wonder what went wrong, please advice.
Cheers
Jason
ASKER
Mohan,
Both are located in the same directory. Will there be any problem? Thanks
Both are located in the same directory. Will there be any problem? Thanks
The code you posted doesn't compile under Tomcat. I took the liberty of modifying it.
-------------------------- ---------- ---------- ---------- --
Test.jsp
<%@ include file="chk_session.jsp" %>
<%@ page language="java" %>
<%@ page import="java.util.*, java.sql.*, javax.servlet.*, javax.servlet.http.*" %>
<html>
<head>
<title>Verify User Profile</title>
</head>
<body>
<center>
<IMG SRC=/images/wsisupport/web shipping.g if height=100>
</center>
</body>
</html>
-------------------------- ---------- ---------- ---------- --
chk_session.jsp
<% out.println("out=" + session.getMaxInactiveInte rval()/60) ;%>
-------------------------- ---------- ---------- ---------- --
There were several problems with this:
1) You can't have the page directive twice in a given JSP page. When you included chk_session.jsp, you had a page directive in both files, so the JSP compier barfed.
2) The session object is created by default. You don't need to create one by hand.
This seemed to work on my machine...
--Steve
--------------------------
Test.jsp
<%@ include file="chk_session.jsp" %>
<%@ page language="java" %>
<%@ page import="java.util.*, java.sql.*, javax.servlet.*, javax.servlet.http.*" %>
<html>
<head>
<title>Verify User Profile</title>
</head>
<body>
<center>
<IMG SRC=/images/wsisupport/web
</center>
</body>
</html>
--------------------------
chk_session.jsp
<% out.println("out=" + session.getMaxInactiveInte
--------------------------
There were several problems with this:
1) You can't have the page directive twice in a given JSP page. When you included chk_session.jsp, you had a page directive in both files, so the JSP compier barfed.
2) The session object is created by default. You don't need to create one by hand.
This seemed to work on my machine...
--Steve
ASKER
Steve,
I have used your code but it did not print out the text for the include file. I have copied exactly from the comment page but it fails.
Any idea why??
Cheers
Jason
I have used your code but it did not print out the text for the include file. I have copied exactly from the comment page but it fails.
Any idea why??
Cheers
Jason
That's odd. What do you see on the page?
For me, I get a line which says "out=30" and a blank image holder.
What JSP container are you using? I'm using the most recent Tomcat.
What browser are you using?
I've run with both IE 5.00 on a Windows box and Netscape 6.01 on a Linux box. They both work.
It sounds as if you have a configuration problem in your JSP container...
Hmm...
--Steve
For me, I get a line which says "out=30" and a blank image holder.
What JSP container are you using? I'm using the most recent Tomcat.
What browser are you using?
I've run with both IE 5.00 on a Windows box and Netscape 6.01 on a Linux box. They both work.
It sounds as if you have a configuration problem in your JSP container...
Hmm...
--Steve
ASKER
Steve,
Sorry for my ignorance but I am totally new to "JSP Container". I am using Netscape Server Enterprise 4. Where should I start degugging? By the way I manage to see the image displayed and nothing else.
Cheers
Jason
Sorry for my ignorance but I am totally new to "JSP Container". I am using Netscape Server Enterprise 4. Where should I start degugging? By the way I manage to see the image displayed and nothing else.
Cheers
Jason
One really stupid question for you.
I noticed in your original post that you called your first JSP Test.jsp yet you refer to loading test.jsp later in the post.
Is it possible that you have two copies laying around? One called Test.jsp and the other test.jsp and you're just loading the wrong one?
I'm not trying to be insulting here, I just can't see how this could fail without some error message being plainly visible in your browser...
--Steve
I noticed in your original post that you called your first JSP Test.jsp yet you refer to loading test.jsp later in the post.
Is it possible that you have two copies laying around? One called Test.jsp and the other test.jsp and you're just loading the wrong one?
I'm not trying to be insulting here, I just can't see how this could fail without some error message being plainly visible in your browser...
--Steve
ASKER
Steve,
Typo errors and I am sure about it. :)
Any clue about this issue?
Cheers
Typo errors and I am sure about it. :)
Any clue about this issue?
Cheers
I've not used Netscape Server, but it shouldn't be much different...
Some things to try:
1) Clean out your browser's cache. Perhaps you're getting cached versions, and not the one you think you're getting.
2) Rename the chk_session.jsp to session.jsp then touch the Test.jsp file to force a recompile. Now when you load the page, you'd better see some sort of compilation error saying that chk_session.jsp is not found. This will tell us whether you're actually getting the JSP file compiled.
3) Rename the session.jsp back to chk_session.jsp and touch the Test.jsp file again. Move the include statement so that it is between the HTML tags. Maybe your browser doesn't like the fact that the data gets printed outside of the HTML page.
Try these and lets see what happens. If this doesn't give us some more info, I'm gonna have to wrack my brain to see what else to try.
--Steve
Some things to try:
1) Clean out your browser's cache. Perhaps you're getting cached versions, and not the one you think you're getting.
2) Rename the chk_session.jsp to session.jsp then touch the Test.jsp file to force a recompile. Now when you load the page, you'd better see some sort of compilation error saying that chk_session.jsp is not found. This will tell us whether you're actually getting the JSP file compiled.
3) Rename the session.jsp back to chk_session.jsp and touch the Test.jsp file again. Move the include statement so that it is between the HTML tags. Maybe your browser doesn't like the fact that the data gets printed outside of the HTML page.
Try these and lets see what happens. If this doesn't give us some more info, I'm gonna have to wrack my brain to see what else to try.
--Steve
ASKER
Steve,
I have tried your advice but it seems that the problem still persist. Is there any configuration that I need to do at the Netscape server side?
Cheers
I have tried your advice but it seems that the problem still persist. Is there any configuration that I need to do at the Netscape server side?
Cheers
ASKER
Steve,
I have tried your advice but it seems that the problem still persist. Is there any configuration that I need to do at the Netscape server side?
Cheers
I have tried your advice but it seems that the problem still persist. Is there any configuration that I need to do at the Netscape server side?
Cheers
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
jason@lc,
These questions are still open. Please resolve them appropriately as soon as possible. Continued disregard of your open questions will result in the force/acceptance of a comment as an answer; other actions affecting your account may also be taken. I will revisit these questions in approximately seven (7) days.
https://www.experts-exchange.com/jsp/qShow.jsp?ta=win2k&qid=20167319
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20153401
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20151128
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20146743
https://www.experts-exchange.com/jsp/qShow.jsp?ta=javascript&qid=20150594
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20245522
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20239352
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20166221
https://www.experts-exchange.com/jsp/qShow.jsp?ta=xml&qid=20243323
https://www.experts-exchange.com/jsp/qShow.jsp?ta=exchangesvr&qid=20240796
EXPERTS: Please leave your thoughts on this question here.
Thanks,
Netminder
Community Support Moderator
Experts Exchange
These questions are still open. Please resolve them appropriately as soon as possible. Continued disregard of your open questions will result in the force/acceptance of a comment as an answer; other actions affecting your account may also be taken. I will revisit these questions in approximately seven (7) days.
https://www.experts-exchange.com/jsp/qShow.jsp?ta=win2k&qid=20167319
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20153401
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20151128
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20146743
https://www.experts-exchange.com/jsp/qShow.jsp?ta=javascript&qid=20150594
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20245522
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20239352
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20166221
https://www.experts-exchange.com/jsp/qShow.jsp?ta=xml&qid=20243323
https://www.experts-exchange.com/jsp/qShow.jsp?ta=exchangesvr&qid=20240796
EXPERTS: Please leave your thoughts on this question here.
Thanks,
Netminder
Community Support Moderator
Experts Exchange
Admin notified of User neglect. Force-accepted by
Netminder
Community Support Moderator
Experts Exchange
Netminder
Community Support Moderator
Experts Exchange
check whether your chk_session.jsp is correctly in your application's path
bye