employee.java
package com.hr.utils;
public class employee
{
// select password, email,surname from employee;
protected int theValue;
protected String password;
protected String email;
protected String surname;
protected String alias;
public employee(){}
public void setMyValue(int newValue){theValue = newValue;}
public int getMyValue() {return theValue;}
public void setPassword(String newValue){password = newValue;}
public String getPassword() {return password;}
public void setEmail(String newValue){email = newValue;}
public String getEmail() {return email;}
public void setSurname(String newValue){surname = newValue;}
public String getSurname() {return surname;}
public void setAlias(String newValue){alias = newValue;}
public String getAlias() {return alias;}
}
LINUX shell
shell# javac employee.java
shell# mkdir /hr/WEB-INF/classes/com/hr/utils -p
shell# cp employee.class /hr/WEB-INF/classes/com/hr/utils/employee.class
LoginCheck.jsp
<%@ page import="java.sql.*" %>
<%@ page import="com.hr.utils.employee" %>
<jsp:useBean id="bean" scope="session" class="com.hr.utils.employee" />
.
.
.
<jsp:setProperty name="bean" property="email" value="<%=username%>" />
<% bean.setEmail(username);%>
<jsp:setProperty name="bean" property="alias" value="<%=mAlias%>" />
<jsp:setProperty name="bean" property="password" value="<%=password%>" />
menu2.jsp
<jsp:useBean scope="session" id="bean" class="com.hr.utils.employee" />
<jsp:getProperty name="bean" property="email"/>
<% out.println(bean.getEmail());%>
沒有留言:
張貼留言