一个公司要求一个简单的员工数据库系统,去管理公司的人员。比如: 员工姓名,ID号,性别,生日,家庭住址,所在部门)要保存在数据库中。公司要求能 :添加和删除员工信息,查看和更改 员工信息。最多50个员工。
(要求 使用简单的GUI, 用array 储存员工数据)请大家帮帮,(或把类似题目的的连接 发一下) 谢谢!本人才刚学,越简单越好!本人邮箱: [email protected]
(要求 使用简单的GUI, 用array 储存员工数据)请大家帮帮,(或把类似题目的的连接 发一下) 谢谢!本人才刚学,越简单越好!本人邮箱: [email protected]
楼主【wu2kai】截止到2008-07-23 01:28:54的历史汇总数据(不包括此帖):
发帖的总数量:9 发帖的总分数:95 每贴平均分数:10
回帖的总数量:7 得分贴总数量:0 回帖的得分率:0%
结贴的总数量:7 结贴的总分数:75
无满意结贴数:0 无满意结贴分:0
未结的帖子数:2 未结的总分数:20
结贴的百分比:77.78 % 结分的百分比:78.95 %
无满意结贴率:0.00 % 无满意结分率:0.00 %
楼主加油
员工信息管理 ~系统,要求用array 储存员工数据,不用数据库!数据库管理系统 不用数据库?
只存放在array中 信息只会存放在内存中
如果程序重启或者电脑重启
那内存中的信息不是都没了?
不存储在持久介质中怎么行?
谢谢大家意见, 我现在学的还没涉及到数据库,只能用arry,程序重启或者电脑重启 消失 无所谓
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;public class LoginValidateServerlet extends HttpServlet { /**
* Constructor of the object.
*/
private List list;
public LoginValidateServerlet()
{
list=new ArrayList();
userbean userb1=new userbean("Berry","red","I am berry!");
list.add(userb1);
userbean userb2=new userbean("Wattermelon","Radandblack","I am Wattermelon and my color is Radandblack!");
list.add(userb2);
userbean userb3=new userbean("Apple","Blue","I am apple in Blue!");
list.add(userb3);
} /**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
} /**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public String judge(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
String name=request.getParameter("name");
String password=request.getParameter("password");
for(int i=0;i<list.size();i++)
{
if(((userbean)list.get(i)).getname().equals(name)&&((userbean)list.get(i)).getpass().equals(password))
{
String userinfo=((userbean)list.get(i)).getintro().toString();
return userinfo;
}
}
return null;
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String name=request.getParameter("name");
String password=request.getParameter("password");
String userinfo=this.judge(request, response);
//来个判断
if(userinfo!=null)
{
request.setAttribute("userinfo",userinfo);
request.getRequestDispatcher("userInfo.jsp").forward(request,response);
}
else
response.sendRedirect("login.jsp");
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}}
private String username;
private String password;
private String Introduction;
public userbean(String username,String password,String intro)
{
this.username=username;
this.password=password;
this.Introduction=intro;
}
public String getname()
{
return this.username;
}
public String getpass()
{
return this.password;
}
public String getintro()
{
return this.Introduction;
}
}
只要将建立一个员工类例如:Employee.class,在该类里建立似有成员数据(姓名,性别之类的),用来存储员工的信息
这样每声明一个employee的实例就代表一个员工然后在主程序中建立一个employees数组 Employee[] employees = new Employee[10],这样在对每个对象进行实例化就可以了
emploees[0] = new Employee(参数);
这个上还有几十分,你回复一下, 也给你
http://topic.csdn.net/u/20080723/00/9820047f-a26e-4aea-aca8-0c119a7713e9.html