searchcommunityaddress.java

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

JAVA
50
字号
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.CommunityaddressDAO;


/*
 * 
 * 查询社区地址动作
 */

public class Searchcommunityaddress extends Action{
	public ActionForward execute(ActionMapping mapping, ActionForm form,
		    HttpServletRequest request, HttpServletResponse response) throws Exception {
		
	   try
	    {
		   //获取查询参数
	    	String str1=request.getParameter("username1");
	    	String str2=request.getParameter("username2");
	    	String str3=request.getParameter("username3");
	    	//查询结果
	    	CommunityaddressDAO a=new CommunityaddressDAO();
	    	ArrayList users = a.searchcommunityaddress(str1,str2,str3);
	    	//String str2 = String.valueOf(users.size());
	    	//保存结果
	    	HttpSession httpsession=request.getSession();
	    	httpsession.setAttribute("addresslist", users);
	    }
	    catch(Exception e)
	    {
	    	request.setAttribute("error", e.toString());
	    	return (mapping.findForward("failed"));
	    }
		request.setAttribute("rrrr", "success");
	    return (mapping.findForward("success"));
	   
	}

}

⌨️ 快捷键说明

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