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

correct code to comeback to home page

 
arekonda ramesh babu
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have one webapplication in that index.jsp is called by default.

i have made one jsp folder and placed two jsp files namingly...

"hai.jsp" and "MyJsp.jsp".

i write in "hai.jsp" the following code to come back to "index.jsp"

<a href="/index.jsp">home </a> and tried to click the home link .

HTTP Status 404 - /index.jsp

--------------------------------------------------------------------------------

type Status report

message /index.jsp

description The requested resource (/index.jsp) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.20

is encountered.

"<a href="/index.jsp">" is this code is right one to do so?

how to correct my mistake

do needful to me

Rameshbabu

 
Milan Jagatiya
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

<a href="/index.jsp">home </a>

because of you are not getting context path there....
use below line...

[code]
<a href=<%request.getContextPath()%>"/index.jsp">home </a>
[code]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Milan Jagatiya's code has an error.

If you are using JSP 1.2, the code to get the context path is



in JSP 2.0, it should be (no scriptlets):

 
Milan Jagatiya
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




yeah Bear,...it was an error...

[ February 07, 2007: Message edited by: Milan Jagatiya ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic