/*
<%@page contentType="text/html"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<jsp:useBean id="userB" class="com.java2s.UserBean" >
<jsp:setProperty name="userB" property="*" />
</jsp:useBean>
<html>
<head><title>Post Data Viewer</title></head>
<body>
<h2>Here is your posted data</h2>
<strong>User name</strong>:
<c:out value="${userB.username}" /><br><br>
<strong>Department</strong>:
<c:out value="${userB.department}" /><br><br>
<strong>Email</strong>:
<c:out value="${userB.email}" />
</body>
</html>
*/
package com.java2s;
public class UserBean implements java.io.Serializable{
String username;
String email;
String department;
public UserBean(){}
public void setUsername(String _username){
if(_username != null && _username.length() > 0)
username = _username;
else
username = "Unknown";
}
public String getUsername(){
if(username != null)
return username;
else
return "Unknown"; }
public void setEmail(String _email){
if(_email != null && _email.length() > 0)
email = _email;
else
email = "Unknown";
}
public String getEmail(){
if(email != null)
return email;
else
return "Unknown";
}
public void setDepartment(String _department){
if(_department != null && _department.length() > 0)
department = _department;
else
department = "Unknown";
}
public String getDepartment(){
if(department != null)
return department;
else
return "Unknown";
}
}
|