Wed Jan 21, 2009 12:11 am
<html>
<title>Codemiles :JSP Form with Java Beans </title>
<body>
<form action="afterindex.jsp" >
<p>First name: <input type="text" name="firstName" size=30>
<br>Last name: <input type="text" name="lastName" size=30>
<br>Email: <input type="text" name="email" size=30>
<p><input type="submit" name="Submit">
</form>
</body>
</html>
<%@ page import="codemiles.Userentry"%>
<%@ page import="codemiles.Userentry"%>
<jsp:useBean id="EntryBean" class="codemiles.Userentry" type="Userentry" scope="application" />
<jsp:setProperty name="EntryBean" property="*"/>
<html>
<body>
<b>
Your data has been submitted
</b>
</body>
</html>
package codemiles;
/**
*
* @author codemiles Team
*/
public class Userentry {
String firstName;
String lastName;
String email;
public void setEmail(String email) {
this.email = email;
System.out.println(email);
}
public void setFirstName(String firstName) {
this.firstName = firstName;
System.out.println(firstName);
}
public void setLastName(String lastName) {
this.lastName = lastName;
System.out.println(lastName);
}
public String getEmail() {
return email;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.