searchuser.java

来自「是一个J2EE的项目,在eclipse下编译通过,应用struts,hibern」· Java 代码 · 共 46 行

JAVA
46
字号
package com.bjjd.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import java.util.ArrayList;

import com.bjjd.DAO.UserinfDAO;


/*
 * 
 * 测试查询人员记录
 */

public class Searchuser extends Action{
	public ActionForward execute(ActionMapping mapping, ActionForm form,
		    HttpServletRequest request, HttpServletResponse response) throws Exception {
		
	    try
	    {
	    	String str=request.getParameter("username");
	    	UserinfDAO a=new UserinfDAO();
	    	ArrayList users = a.searchuserinf(str);
	    	String str2 = String.valueOf(users.size());
	    	HttpSession httpsession=request.getSession();
	    	httpsession.setAttribute("personlist", users);
	    }
	    catch(Exception e)
	    {
	    	request.setAttribute("error", e.toString());
	    	return (mapping.findForward("failed"));
	    }
	    
	   
	    return (mapping.findForward("success"));
	   
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?