wood burning stoves 2.0*
The moose likes JSP and the fly likes uable to execute jsps Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "uable to execute jsps" Watch "uable to execute jsps" New topic
Author

uable to execute jsps

Geeta Ravikanti
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
Hi all,
i getting the problem while excuting the jsp page
i am creating the user regisration form and storing the datials i database
for this i created one html page and next excuting jsp page ang bean class

the program paths are

C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\urf.html

C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\WEB-INF\classes\reguser.jsp

C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\WEB-INF\classes\UMBean.java

C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\WEB-INF\web.xml

urf.html

<html>
<head><title>User Registration</title></head>
<body>
<form action="reguser.jsp">
User Name
<input type="text" name="usernmae"><br>

Password
<input type="text" name="pwd"><br>

Age
<input type="text" name="age"><br>

Email
<input type="text" name="email"><br>


<input type="submit" name="register"><br>
</form>
</body>
</html>


reguser.jsp

<jsp:useBean id="umb" scope="page" class="org.students.UMBean"/>
<jsp:setProperty name="umb" property="*"/>
<%
umb.registerUser();
%>
following data is stored in d/b


<jsp:getProperty name="umb" property="username"/><br>
<jsp:getProperty name="umb" property="pwd"/><br>
<jsp:getProperty name="umb" property="age"/><br>
<jsp:getProperty name="umb" property="email"/><br>




package org.students;

import java.sql.*;
import java.io.*;

public class UMBean{

private String uname;

private String pwd;

private String email;

private int age;

//setters


public void registerUser()throws Exception
{

Class.forName("oracle.jdbc.driver.OracleDriver");

Connection con=DriverManager.getConnection("jdbcracle:thin:@localhost:1521:xe","SYSTEM","remora");

System.out.println("connceted----->"+con.getClass());


String vsql="insert into app_users values(?,?,?,?)";

PreparedStatement psmt=con.prepareStatement(vsql);

psmt.setString(1,this.uname);
psmt.setString(2,this.pwd);
psmt.setInt(3,this.age);
psmt.setString(4,this.email);

psmt.executeUpdate();
con.close();
}


public void setUsername(String uname)
{
System.out.println("set username---"+uname);
this.uname=uname;
}

public void setPassword(String pwd)
{
System.out.println("set username---"+pwd);
this.pwd=pwd;
}

public void setEmail(String email)
{
System.out.println("set username---"+email);
this.email=email;
}

public void setAge(int age)
{
System.out.println("set age---"+age);
this.age=age;
}
//getters
public String getUsername(String uname)
{
System.out.println("get username---"+uname);
return this.uname;
}

public String getPassword(String pwd)
{
System.out.println("get username---"+pwd);
return this.pwd;
}

public String getEmail(String email)
{
System.out.println("get username---"+email);
return this.email;
}

public int getAge(int age)
{
System.out.println("get age---"+age);
return this.age;
}

public UMBean()
{
System.out.println("Executed........");
}
}


web.xml

<web-app>
<servlet>
<servlet-name>Simple</servlet-name>
<servlet-class>reguser.jsp</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Simple</servlet-name>
<url-pattern>/reguser.jsp</url-pattern>
</servlet-mapping>
</web-app>




my url path is http://localhost:8082/honey/urf.html
after that it goes to reguser.jsp
but here i am getting following error


HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Wrapper cannot find servlet class reguser.jsp or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
java.lang.Thread.run(Thread.java:595)


root cause

java.lang.ClassNotFoundException: reguser.jsp
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
java.lang.Thread.run(Thread.java:595)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.25 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.0

please tell me where did i mistake
i did every thing correct in my view
but i am unable to rectify error
[ April 15, 2008: Message edited by: Bear Bibeault ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Geeta Ravikanti,
Welcome to JavaRanch!

In an effort to help you get the most from our forums, we've compiled a
list of tips for asking questions here. You can find the list in our
FAQ section here.
In particular please see:
UBB CODE tags
Unformatted code is tiring to read so, many people won't read it.

Also, please see:
UseRealWords
Abbreviations such as "u" or "ur" in
place of "you" and "you are" or "you're" confound language translation software making
it hard for our non-English speaking members to read your posts.
"plz" is not a word in the English language.

Again, welcome to JavaRanch and good luck with your question.
-Ben


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you want to create a servlet entry for a JSP, don't use the servlet-class attribute.
<servlet-class>reguser.jsp</servlet-class>

Use the jsp-file attribute instead.
Geeta Ravikanti
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
Sorry,
I din't get you where the changes i made in the program
can you tell me in detail
Geeta Ravikanti
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
i changed the code like following
<web-app>
<servlet>
<servlet-name>Simple</servlet-name>
<jsp-file>/reguser.jsp</jsp-file>
<load-on-startup>1</load-on-stratup>
</servlet>

<servlet-mapping>
<servlet-name>Simple</servlet-name>
<url-pattern>/simple</url-pattern>
</servlet-mapping>
</web-app>

but when ever i am execuitng this code in tomcat server,its giving "Running" option as false

what to do,how can i change the code
please let me know the solution
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Geeta Ravikanti:
<web-app>
<servlet>
<servlet-name>Simple</servlet-name>
<jsp-file>/reguser.jsp</jsp-file>
<load-on-startup>1</load-on-stratup>
</servlet>


According to your first post, this is not where reguser.jsp is.
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\WEB-INF\classes\reguser.jsp



Try:
<jsp-file>/WEB-INF/classes/reguser.jsp</jsp-file>

Or, better, move your jsp out of the classes directory.
There is no need for it to be in there.
[ April 15, 2008: Message edited by: Ben Souther ]
Geeta Ravikanti
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
tahnQ for the response

i moved the reguser.jsp file in honey directory

here my paths are like folowing
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\urf.html--->HTML file
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\reguser.jsp---->jsp file
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\weh-inf\classes\UMbean.class---->bean class

my url apth is http://localhost:8082/honey/urf.html

here i entered following things
username :geeta
pwd:geeta
Age:24
Email:geeta@yahoo.com
after that i click on submit button
but here its not fingind reguser.jsp
its giving folloeing error
where can i change
type Status report

message /reguser.jsp

description The requested resource (/reguser.jsp) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.25

how can i get the solution
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Should you not be accesing it with the associated name "Simple" defined in web.xml?


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61104
    
  66

I'd like to know why you're going through all these hoops and hassle in the first place.

Just move the JSP out of WEB-INF and address it directly.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Geeta Ravikanti:
tahnQ for the response


Please read this.
Geeta Ravikanti
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
thanQ for all giving the reply
In my program i am inserting the data from html page,it will call jsp page and it call Bean(UMBean.java) class what i wrote the code in program

But what i ahve one dought

I need to validate whether a user name has already been registered when creating an online account

for this i dont know how to write the code and where to write the code

can any one help in this
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61104
    
  66

Originally posted by Geeta Ravikanti:
thanQ for all giving the reply


Please read this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: uable to execute jsps