• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with bean in tomcat

 
shelly sharma
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have tomcat running on my pc.I'm trying to learn jsp using forms and beans.I have 1 HTML file, 2 jsp files, 1 java file, and 1 class file.
This is my 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>
---------------------------------------------------------

This is my SaveName.jsp file:
<jsp:useBean id="user" class="UserData" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<HTML>
<BODY>
<A HREF="NextPage.jsp">Continue</A>
</BODY>
</HTML>
---------------------------------------------------------

This is my 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>
---------------------------------------------------------

This is my UserData.java bean file:
public class UserData {
String username;
String email;
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; }
}
---------------------------------------------------------
I placed the GetName.html, SaveName.jsp,UserData.java and NextPage.jsp files under the c:/tomcat/webapps/examples folder.
Then, I placed the UserName.class file under the c:/tomcat/classes folder
when i run the server and opened th GetNmae.html file in browser then it is opened. Then i put the values of name, email,age in the textboxes, then i clicked on submit. After clicking submit error message is coming that SaveName.jsp file not found. Why is it so coming. Can anybody give me a solution.
[ September 30, 2003: Message edited by: shelly sharma ]
 
Neeraj Singhal
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shelly
How are you accessing the html and jsp in the browser ??
I mean...what URL are u specifying.
 
shelly sharma
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Neeraj Singhal:
Hi Shelly
How are you accessing the html and jsp in the browser ??
I mean...what URL are u specifying.

I am writing:
http://localhostt:8080/examples/file.html
http://localhostt:8080/examples/file.jsp
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic