| Author |
path of jsp is repeated and i get error jsp not found
|
supriya riya
Ranch Hand
Joined: Feb 23, 2009
Posts: 41
|
|
i login by username password then go to servlet login then valid.jsp page ,then if i click next i go to nextpage.jsp.then on each page i have navbar.jsp inserted by using the page include directive of jsp,which hashyperlink for logout.jsp.problem is i am getting following error, if i click logout from nextpage.jsp,but from valid.jsp i logout sucessfully.
error is:Path is repeated..i m getting error if i use request.getcontextpath in href..help
i have my pages in webdoc/admin folder in webpages
--------------------------------------------------------------------------------
type Status report
message /webdoc/admin/webdoc/admin/logout.jsp
description The requested resource (/webdoc/admin/webdoc/admin/logout.jsp) is not available.
MY login1.jsp
<form name="f" onsubmit="return chk();" method="post" action="<%=request.getContextPath()%>/login">
valid.jsp
<form>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" bgcolor = "#FF9934"> <center><jsp:include page = "navbar.jsp" /> </center></td>
</tr>
<td align="center" valign="bottom" class="tc-hd">Welcome to <%=usernam%><a href= "webdoc/admin/nextpage.jsp">Next</a></td>
nextpage.jsp
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" bgcolor = "#FF9934"> <jsp:include page = "navbar.jsp" /> </td>
</tr>
navbar.jsp which i have included by include page
<body>
<%
String uid = "";
String type= "";
try
{
uid = session.getAttribute("usernam").toString();
}
catch(Exception e)
{}
%>
<table width="100%">
<tr>
<td valign="bottom" align="right">
<%
if(uid.length() != 0)
{
out.println("<h3>Welcome "+ uid + "</h3>");
}
%>
<a href ="webdoc/admin/logout.jsp">Logout </a>
</td>
<td valign="bottom" align="right"></td>
</tr>
</table>
logout page
<tr>
<td colspan="2" bgcolor = "#FF9934" align="right"> <a href = login1.jsp> Home</a></td>
</tr>
<tr>
<td width = 4% > </td>
<td>
<%
session.invalidate();
%>
<br>
<h2>You have successully logged out of the system</h2>
</td>
</tr>
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
Hi Supriya, welcome to javaranch.
I think this statement in the navbar.jsp is causing the problem
<a href ="webdoc/admin/logout.jsp">Logout </a>
change it with this
<a href ="<%=request.getContextPath()%>/webdoc/admin/logout.jsp">Logout </a>
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
supriya riya
Ranch Hand
Joined: Feb 23, 2009
Posts: 41
|
|
hi ankit garg it solved my problem.ithink i need to know hoe request.getcontextpath works exactly.
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
|
look Supriya, the solution that I gave is partially right. We should not use scriptlets in JSP pages. But I'm not good at EL and JSTL that's why I gave you a quick solution. But I think the correct solution is to use JSTL url tag or something else but frankly I don't know myself...
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
Ankit Garg wrote:the solution that I gave is partially right. We should not use scriptlets in JSP pages.
Well Ankit . in EL ${pageContext.request.contextPath} .
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
seetharaman venkatasamy wrote:
Ankit Garg wrote:the solution that I gave is partially right. We should not use scriptlets in JSP pages.
Well Ankit  . in EL ${pageContext.request.contextPath} .
Thanks
|
 |
 |
|
|
subject: path of jsp is repeated and i get error jsp not found
|
|
|