• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with bean in tomcat

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
And when my army is complete, I will rule the world! But, for now, I'm going to be happy with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic