File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp file not found, when calling another jsp file

 
northfield Sid
Ranch Hand
Posts: 106
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a jsp called login, the file is written out below.
<HTML><HEAD><TITLE>JSP Checks Login Information Against Parameters</TITLE></HEAD><BODY>
<H2> Login </H2>
<FORM ACTION=/loginCheck METHOD=POST>
Username : <INPUT TYPE=TEXT NAME=usernameFormParameter><BR>
Password : <INPUT TYPE=TEXT NAME=passwordFormParameter><BR>
<INPUT TYPE=SUBMIT VALUE=Login>
</FORM>
</BODY></HTML>
The above file calls another file called called loginCheck.jsp. I have written out the jsp below:
<HTML><HEAD><TITLE>JSP Checks Login Information Against Parameters</TITLE></HEAD><BODY>
<H1>Hello</H1>
<%
String usernameFormParameterValue = request.getParameter("usernameFormParameter");
String passwordFormParameterValue = request.getParameter("passwordFormParameter");
if(usernameFormParameterValue!=null){
String usernameInitParameterValue = config.getInitParameter("username");
String passwordInitParameterValue = config.getInitParameter("password");
if(usernameFormParameterValue.equals(usernameInitParameterValue)&&passwordFormParameterValue.equals(passwordInitParameterValue)){
// login correct, greetings %>
Welcome !!!
<%
} else {
// login incorrect, please try again %>
Sorry but we dont know you <BR>
Would you like to <A HREF=login.jsp>try again</A>
<% }
} else {
// login incorrect, please try again %>
Sorry but your login is incorrect <BR>
Would you like to <A HREF=login.jsp>try again</A>
<% }
%>
</BODY></HTML>
Both files are at this location:
D:\tomcat\jakarta-tomcat-3.3.1\webapps\myJSPs\jsp\Hour13
I enter the url in the browser address box:
http://localhost:8080/myJSPs/jsp/Hour13/login.jsp
I then enter Username: northfield
Password: 12345
and press <login> button
After pressing the login button a new page is shown in the browser and in the browser address box a url:
http://localhost:8080/loginCheck
The error message that is given is:
The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
--------------------------------------------------------------------------------
Please try the following:
If you typed the page address in the Address bar, make sure that it is spelled correctly.
Open the localhost:8080 home page, and then look for links to the information you want.
Click the Back button to try another link.
Click Search to look for information on the Internet.
HTTP 404 - File not found
Internet Explorer
 
Pat Wallwork
Ranch Hand
Posts: 72
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In the code you posted above you've put action=/loginCheck
It should read action=/loginCheck.jsp
-Pat
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic