• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

correct code to comeback to home page

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator





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

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