• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

404 again!

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
installed tomcat5.0
created form.html in D:\tomcat5.0\webapps\hello
<html>
<body>
<form action ="result.jsp">
Name: <input type="text" name="name">
<input type="submit">
</form>
result.jsp in D:\tomcat5.0\webapps\hello
<html>
<body>
<p>
${param.name}
</body>
</html>

http://localhost:8080/hello/form.html
is giving 404 error

y does this same error occurs everytime we create a new web application! plzzzzz some one help
 
pallavi utukuri
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
k some miracle happened and http://localhost:8080/hello/form.html
is working indeed.....
but now EL is not recognized its just displaying
${param.name}
 
pallavi utukuri
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
k some miracle happened and http://localhost:8080/hello/form.html
is working indeed.....
but now EL is not recognized its just displaying
${param.name}
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the "hello" directory supposed to be a web application? Does it have a WEB-INF subdirectory with a web.xml file?
Bill
 
pallavi utukuri
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ys hello is a web application it has
WEB-INF/classes
WEB-INF/lib/jstl.jar and standard.jar
web.xml
 
pallavi utukuri
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
changed <web-app> in web.xml as follows:

<web-app xmlns="http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

its working now.....but when i tried the same thing for servlet, EL is retruning null.

created Testj.java in
D:\tomcat5.0\webapps\hello\WEB-INF\classes\Testj.class
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class Testj extends HttpServlet{
public void doGet(HttpServletRequest request,HttpServletResponse response)throws IOException,ServletException {
response.setContentType("text/html");
request.setAttribute("ename","baba");
RequestDispatcher view = request.getRequestDispatcher ("result.jsp");
view.forward(request,response);
}
}

result.jsp in D:\tomcat5.0\webapps\hello
<html>
<body>
name:${param.ename}
</body>
</html>

http://localhost:8080/hello/Testj

the output is
name:

i.e EL is return null whats wrong if its working from html y not from servlet
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by pallavi utukuri:
changed <web-app> in web.xml as follows:

<web-app xmlns="http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

its working now.....but when i tried the same thing for servlet, EL is retruning null.

created Testj.java in
D:\tomcat5.0\webapps\hello\WEB-INF\classes\Testj.class
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class Testj extends HttpServlet{
public void doGet(HttpServletRequest request,HttpServletResponse response)throws IOException,ServletException {
response.setContentType("text/html");
request.setAttribute("ename","baba");
RequestDispatcher view = request.getRequestDispatcher ("result.jsp");
view.forward(request,response);
}
}

result.jsp in D:\tomcat5.0\webapps\hello
<html>
<body>
name:${param.ename}
</body>
</html>

http://localhost:8080/hello/Testj

the output is
name:

i.e EL is return null whats wrong if its working from html y not from servlet



In the case of using a servlet you have set "ename" as a request attribute and is not a request paramter as in the html version. I suspect this is why ${param.ename} is givng null.
Try ${ename} instead.
 
    Bookmark Topic Watch Topic
  • New Topic