2013年12月5日 星期四

java-javabean servlet-javabean


java get javabean
servlet get javabean



Showparameters.java
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import com.hr.utils.CompanyProfile;

public class ShowParameters extends HttpServlet {
static tableWrite2 MySql = new tableWrite2();
CompanyProfile CompanyProfile=new CompanyProfile();
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
 
       out.println(CompanyProfile.getCompanyName());
      }
}


CompanyProfile.java  //<< BEAN
package com.hr.utils;  
import java.util.Date;
public class CompanyProfile implements java.io.Serializable {
  protected static String companyName;
  public CompanyProfile(){}

 public void setCompanyName(String newValue){companyName = newValue;}
 public String getCompanyName(){return companyName;}

}






沒有留言:

張貼留言