How to run JSP in Tomcat
Hi i am new to java web application, i am running JSP(edited in notepad) in tomcat
<html>
<head>
<title>first jsp page</title>
</head>
<body>
<%! String st = "shyam your JSP Code" %>
Welcome ::<%= st %>
</body>
</html>
i saved this jsp as first.jsp and D:\shyam\Apache Software Foundation\Tomcat 5.0\webapps\ROOT putting jsp in this folder.
then started tomcat webserver
then opeand browser giving URL: http://localhost:8080/first.jsp
the error coming like--> HTTP status 500
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
root cause:
unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
Error coming like this, plz tell how to rectify this, I want to set any thing in web.xml, tell where i did mistake.
hi,
your problem is you didn't set java home in your path..
before running your application create a ".bat" file like,
set JAVA_HOME="path where you installed jdk eg: c:\jdk1.5";
Similar Messages
-
How to run jsp in tomcat server
hi this is satish1529,
i am new to jsp technology,i have written small jsp file and html file,i don't know where to place jsp and html files in tomcat server and where i have to do setting in the server and how to run jsp file. pls give me step by step describing how to run jsp in tomcat server.
i am showing u files
this is jsp file
<html>
<body>
<center> data recieved from client <center>
<%
String s= request.getParameter("t1");
String a= request.getParameter("t2");
%>
username :<%=s%><br>
address :<%=a%>
</body>
</html>
this is html file
<html>
<body>
<form action="http://localhost:8080/form.jsp">
enter name <input type="text" name="t1"> <br>
enter address <textarea name="t2"> </textarea> <br>
<input type="submit" vaule="login">
</form>
</body>
</html>Thanx a lot for ur promt reply.
we r succful in running simple jsp in tomcat6.0.
bt one more problem occured as following when we r trying to run jsp file in tomcat.
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /main1.jsp(1,1) The value for the useBean class attribute webCounter is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1200)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1155)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2392)
org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
org.apache.jasper.compiler.Generator.generate(Generator.java:3374)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:210)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs. -
How to Run JSP in Tomcat Server 3.3.2
Hi all,
i have just installed tomcat server 3.3.2 in my system which as windows xp home edition as a operating system and no problem i can able to start the tomcat server.But the problem is that i dont no how to run jsp in tomcat i listed some of my problems below..
How to put my jsp file in the virtual directory(default and also i want to create ) then tell me how use IE to run the JSP file.
Thanks in advance..
With Regards
VijayHi all,
i have just installed tomcat server 4.1 in my
system which as windows NT 4.0 home edition as a
operating system and no problem i can able to start
the tomcat server.But the problem is that i dont no
how to run jsp in tomcat i listed some of my problems
below..
How to put my jsp file in the virtual
directory(default and also i want to create ) then
tell me how use IE to run the JSP file.
Thanks in advance..
With Regards
Baliram -
How to run jsp using tomcat server?
hai friends,
i'm using jsp for my application and for that i'm using tomcat server.
i was runing my jsp files like this
http://localhost:8080/examples/jsp/myapp/index.jsp but instead of this
i need to run my jsp files like this
http://localhost:8080/myapp/index.jsp
what r the changes that i should do in tomcat installation to run myapplication in such a way.
thanks in advanceyou need to redefine the server root...
for that do the following...
copy all the directory tree rooted at
JAKARTA-HOME/webapps/ROOT/examples/jsp/myapp/ to
JAKARTA-HOME/webapps/ROOT/myapp/
-OR-
in the server.xml, search for "Tomcat Root Context" and un-comment the code defining Root Context...
change the docBase value from "ROOT" to "ROOT/examples/jsp"
that shud help...
-Pranav
hai friends,
i'm using jsp for my application and for that i'm
using tomcat server.
i was runing my jsp files like this
http://localhost:8080/examples/jsp/myapp/index.jsp but
instead of this
i need to run my jsp files like this
http://localhost:8080/myapp/index.jsp
what r the changes that i should do in tomcat
installation to run myapplication in such a way.
thanks in advance -
How to Run servlet in Tomcat 5.5.9
hi
How to run servlet in tomcat 5.5.9?how to set context path in server.xml of conf folder in tomcat since there is no context tag in server.xml.
JitenHi ! I have a similar problem, well, it's along the same line ...
I'm using NetBeans 4.1, and i've coded a servlet. Using NetBeans to launch my servlet (with the bundled Tomcat 5.5.7) works fine, however i need to deploy my application unto a Tomcat 5.5.9 server.
Thus, i copied the WAR file generated by NetBeans into the Tomcat 5.5.9 webapps directory, and Tomcat expands it.
Problem is when i run my JSP pages with the form tags, they do not work on the Tomcat 5.5.9 environment. Anyone knows why?
(These work on the NetBeans Tomcat bundle 5.5.7)
My form action :
<form name="index" method="get" action="PageServlet">
My web.xml :
<servlet>
<servlet-name>PageServlet</servlet-name>
<servlet-class>application.PageServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PageServlet</servlet-name>
<url-pattern>/PageServlet</url-pattern>
</servlet-mapping>
I'm really stumbed on why it doesn't work in Tomcat 5.5.9, any help is greatly appreciated, thanks in advance ^_^ -
How to run JSP pages in weblogic 8.1 sp2
hi frnzs,
plese give me some idea about how to run JSP pages in weblogic server.enen i dont know hw to fly palne otherwise i can definitely give u sm guides abt that......
-
How to run Servlet in Tomcat 5.5.7 Server
Hi,
How to run Servlet in Tomcat 5.5.7 Server. I mean where I should copy my *.class file.
Thanks in Advance.
bbye.In order to complile the servlet you need to tell java where to find the servlet libary (as stated above by setting the class path). or (much easier IMO)
copy the servlet-api.jar to
JavaInstallDirectory\jre\lib\ext -
Hi ,
How to run servlets in tomcat server. I created two files html and servlet file.
Html file
callservlet.html
<html>
<body>
<form method=post action="servletcalled.class">
<input type=submit value="submit">
</form>
<body>
</html>
servlet file
servletcalled.java contains
public void doPost(HttpServletRequest req,HttpServletResponse res ){
java.io.PrintWriter out = req.getWriter();
out.println("Hi, executed");
i put the callservlet.html in webapps/examples/ and servletcalled.class was in webapps/examples/Web-inf/classes/
After starting the tomcat and running the program html file is getting exceuted but when i click on the submit button this error is prompted
type Status report
message servletcalled.class
description The requested resource (servletcalled.class) is not available.
Thanks in advanceThanks,
I created a new directory in webapps
s "webapps/test".
Test directory contains
1. callservlet.html file
2. another directory Web-inf (i.e,
webapps/test/Web-inf)
Web-inf directory contains
1. web.xml file
2. another directory classes (i.e,
webapps/test/Web-inf/calsses)
classes directory contains
1. servletcalled.class file
web.xml file contains
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>Example</servlet-name>
<servlet-class>Example</servlet-class>
</servlet>
</web-app>
-->should be: <servlet-class>servletcalled</servlet-called>
then in the <web-app> scope define this:
<servlet-mapping>
<servlet-name>Example</servlet-name>
<url-pattern>/servlets/Example</url-pattern>
</servlet-mapping>
>
thanks in advance i am working hard on that but
notable to get the solutionbtw by reading the documentation of tomcat and tutorials of jave on the java site (here), you would have known this! -
How to run jsp in weblogic server
hi,
how to run jsp application in weblogic server,plz send the procedure how to deploy..
ThanksHow to run JSP and EJB program using weblogic server
-
How to deploy JSPs in Tomcat 5.5
hello all
i am Mayuresh Trivedi. i don't know how to Deploy Jsps in Tomcat 5.5. i m using MYSql as Backend. i m trying to use "import" command in Jsp so it shows me error like under :
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
Syntax error on token "import", delete this token
Generated servlet error:
Syntax error on token "import", delete this token
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.7 logs.
so , can any body help me please ?hi
first create a arbitrary folder in \webapp folder in tomcat home foder.
for instance \webapp\myJSP
second you must create a folder with this name : \WEB-INF under myJSP folder
then make a web.xml in that
so write in web.xml this :
<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">
<description>
myJSP
</description>
<display-name>JSP 2.0 Examples</display-name> -
Unable to run jsp in tomcat 5.0
hi ,
iam unable to run jsps in tomcat 5.0.
i get an error saying ,unable to compile java compiler
iam able to compile servlets & execute them.
i have already set the paths for JAVA_HOME & CATALINA_HOME
please guide me accordingly
regards ,
shaileshthe same code gets executed in other system in which there is only one jdk.
the system which iam using has got many jre s due to
1) netbeans IDE
2)Weblogic server
3) jdk 1.4 was previously installed
4) jdk 1.5 was also installed
but i have set JAVA_HOME =jdk1.6
I doubt the compiler is trying to compile itself or another compiler
regards ,
shaileshkumar -
How to run JSP/Servlet in AIX?
how to run JSP/Servlet in AIX?
I am no ideas about it,
can anyone tell me?
what webserver i should use?
have to install JDK?The only successful way that I have been able to run servlets in an AIX environment is with the IBM Http Server (specific version of Apache)/WebSphere combination, with WebSphere as the servlet engine. I have tried (unsuccessfully) to use JRun and Apache in AIX environment, but could never get JRun to function properly.
-
How to run jsp file in Apache Tomcat 5.0?
hi,
i'm using jdk1.5,jsp1.2 & Apache Tomcat 5.0 as a web server.in my application i have 2 jsp files,1 html file & 1 javabean class.where i must place the html,jsp files and the .java file & .class file for a bean class.how to run this application.
bean class:
public class Userdata {
private String username;
private String email;
private int age;
public void setUsername( String value )
username = value;
public void setEmail( String value )
email = value;
public void setAge( int value )
age = value;
public String getUsername() { return username; }
public String getEmail() { return email; }
public int getAge() { return age; }
getname.html file:
<HTML>
<BODY>
<FORM METHOD=POST ACTION="Savename.jsp">
What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
<P><INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>
savename.jsp file:
<jsp:useBean id="user" class="Userdata" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<HTML>
<BODY>
Continue
</BODY>
</HTML>
nextpage.jsp file:
<jsp:useBean id="user" class="Userdata" scope="session"/>
<HTML>
<BODY>
You entered<BR>
Name: <%= user.getUsername() %><BR>
Email: <%= user.getEmail() %><BR>
Age: <%= user.getAge() %><BR>
</BODY>
</HTML>
refer these source code and plz,give the result at the earliest.
whether i want to write a web.xml file for this jsp file.
if yes,means plz present the web.xml file for this application.
plz,if anybody knows give me detailed description for this application.create a dir under webapps dir
place your .html and .jsp files here
also create WEB-INF dir here
Under WEB-INF create classes and lib dir
under classes dir put your .class file
You also need to put web.xml under your WEB-INF dir.
You ca keep your java file any where u want on your computer. -
is i can able to run my jsp program by using appache server..
To get JSP working in Apache HTTP Server you have to install Apache Tomcat.
You can either choose to run JSP's solely on Apache Tomcat, or to use mod_jk2 to link Apache HTTP Server with Apache Tomcat so that the Apache HTTP Server can forward the JSP requests to the Apache Tomcat engine, because the Apache HTTP Server really doesn't know how to compile/run JSP's. -
How to run JSP/Servlet applications on Apache?
As we all know that tomcat is an JSP/Servlet engine. Apache is a web server not a JSP/Servlet enabled web server. Then in order to run JSP/Servlet applications on Apache web server on unix, what should I do?
Thanks.
James LiuCan you give me some detailed information about how to combine Apache and Tomcat? Note, the application is going to run on Sun Solaris Operating System.
By the way, where do you put your final version of application? on windows or on Unix? on tomcat or on apache?
I am building the application using tomcat on windows, but now I almost finished the application, so I decide to move it to Unix which uses apache as the web server. But I got problems, the Servlet engine (JServ) can not understand "RequestDispatcher" (an object used to redirect jsp pages).
Help please.
James
Maybe you are looking for
-
Sharepoint 2013 - Active Directory Import User Profile Property manager fields
Hi there, I juste encountered actually a little issue regarding the Active Directory Import User Profil. Importation seems to work well but I have a little problem regarding the Manager field. When I verify a user profil through the sharepoint admin
-
i just created a new apple id for my self and when i go to update an app it shows my moms email and she wont tell me her password how do i get my email to show up
-
Is there away to get your money back?
I've had a few attempts using these discussion pages to overcome my understanding of this machine and it soft ware but I've had to give up. I purchased the machine from PC world and they where very good and even offer a full refund after two weeks if
-
Hello, Have a 2006 MBP core duo that Safari seems to stall and not load web pages using wireless or CAT 5, have reloaded the OS starting with Tiger and have progressed thru Snow Leopard and still no luck, I-chat works no issues and have done all the
-
but i have problem in step 13. i can't see step 13 because the red box which has this message " please contact itunes support to complete this transaction" apears. plz help me how can i pass this step