RSS Forums RSS
Please support our JSP advertiser: Lunarpages JSP Web Hosting

jsp,eclipse and weblogic server

Join Date: Apr 2007
Posts: 6
Reputation: abhishek.tyagi1 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
abhishek.tyagi1 abhishek.tyagi1 is offline Offline
Newbie Poster

Re: jsp,eclipse and weblogic server

  #5  
Apr 24th, 2007
Originally Posted by jwenting View Post
Did you add an import statement to the JSP declaration?

hi!
plz help me. i am using weblogic server and eclipse for my project. i want to know how to load javabean classes into a jsp page.
here is my code, i m just trying a simple example
form to get user input
named get.htm

<HTML>
<BODY>
<FORM METHOD="post" ACTION="Save.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>

jsp page to process it named save.jsp

<jsp:useBean id="user" class="my.UserData" scope="session"/>
<jsp:setProperty name="user" property="*" />

<HTML>
<BODY>
You entered<BR>
Name: <%= user.getUsername() %> <BR>
Email: <%= user.getEmail() %><BR>
Age: <%= user.getAge() %><BR>

</BODY>
</HTML>

and this is my javabean class named UserData.java
package my;

publicclass 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; }

}
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 9:08 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC