• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why is this so in jsp?

 
sachin dabhade
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Blanki have a problem in JSP.
my html page is as follows :
******** index1.html
<html><body>
<form action="http://127.0.0.1:8080/examples/jsp/demo/name.jsp"
method="post" >
<input type=text name=t1>
<input type=submit>
</form>
</body></html>
**********************
My jsp page is as follows :
******** name.jsp
<html><body>
Your Name is <%= request.getParameter("t1")
System.out.println("Hello");
%>
</body></html>

**********************
Its a simple and straight forward code but i am getting error as
************** Error :
Error: 500
Location: /examples/jsp/demo/name.jsp
Internal Servlet Error:
javax.servlet.ServletException: sun/tools/javac/Main
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java, Compiled
Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java,
Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java,
Compiled Code)
at java.lang.Thread.run(Thread.java:479)
Root cause:
java.lang.NoClassDefFoundError: sun/tools/javac/Main
at
org.apache.jasper.compiler.SunJavaCompiler.compile(SunJavaCompiler.java:128)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java, Compiled
Code)
at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462)
at
org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:433)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java:152)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:164)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java, Compiled
Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java,
Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java,
Compiled Code)
at java.lang.Thread.run(Thread.java:479)
*********************

i am using TOMCAT Version 3.2.1
i am very new to jsp and not getting out of the blues.
can anybody help me ?

thank you in advance.
sachin
 
marko markovic
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error that you get says that tomcat doesn't found the classes that you use!
Your classes must be in the folder web-inf/classes with the directory-hierarchy of your packages if you have.
In Js Pages you must import the packages/classes that you need!
$Regards
 
Angela Poynton
Ranch Hand
Posts: 3143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also I think you've missed a few closing statments ... you JSP should look like this.
<html><body>
Your Name is <%= request.getParameter("t1") %>
<%
System.out.println("Hello");
%>
</body></html>
I'm assuming you want "hello" to be printed to the console / log rather than to the page!
If you want Hello to be printed to the page ... then your JSp should look like this.
<html><body>
Your Name is <%= request.getParameter("t1")%>
Hello
</body></html>
[This message has been edited by Angela Poynton (edited March 20, 2001).]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Root cause:java.lang.NoClassDefFoundError: sun/tools/javac/Main
It is looking for the Java compiler to compile the JSP - you need to have tools.jar in the classpath somewhere.
<input type=text name=t1>
For compatibility with all browsers and the HTML spec, you should be enclosing those strings in quotes. ie:
<input type="text" name="t1">
Bill

------------------
author of:
 
sachin dabhade
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Angela Poynton:
Also I think you've missed a few closing statments ... you JSP should look like this.
<html><body>
Your Name is <%= request.getParameter("t1") %>
<%
System.out.println("Hello");
%>
</body></html>
I'm assuming you want "hello" to be printed to the console / log rather than to the page!
If you want Hello to be printed to the page ... then your JSp should look like this.
<html><body>
Your Name is <%= request.getParameter("t1")%>
Hello
</body></html>
[This message has been edited by Angela Poynton (edited March 20, 2001).]


Dear sir,
thanks for your reply.
i got the way out of it using your code.
thanks for your guidence
sachin
 
Angela Poynton
Ranch Hand
Posts: 3143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome .. always glad to help .. and BTW I'm a girl so Dear Miss would have be a better salutation ... I'll put it down to a simple mistake and take my praise.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic