首页>代码>jsp+servlet开发java web在线租车服务系统>/opencar/src/com/weishang/my/action/AuntList.java
package com.weishang.my.action;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.weishang.my.pojo.Aunt;
import com.weishang.my.pojo.Comment;
import com.weishang.my.service.ShopService;
import com.weishang.pojo.Template;
import com.weishang.service.UserService;
import com.weishang.tool.CommonUrl;
@WebServlet(displayName="获取外部员工的信息",name="AuntList",urlPatterns="/aunt")
public class AuntList extends HttpServlet{

	private static final long serialVersionUID = 1L;

	/**
	 * Constructor of the object.
	 */
	public AuntList() {
		super();
	}

	/**
	 * 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 void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("text/html;charset=UTF-8");
		ShopService ss=new ShopService();
		UserService us=new UserService();
		String jsp="";
		Template tpl=null;
		String pageNoTem=request.getParameter("page") ;
		Integer pageNo=0;
		if(pageNoTem!=null){
			pageNo=Integer.parseInt(pageNoTem);
		}else{
			pageNo=1;
		}
		String pageSizeTem=CommonUrl.getValue("user_page");
		Integer pageSize=Integer.parseInt(pageSizeTem);
		List<Aunt> auntList=null;
		List<Comment> commetnList=null;
		Aunt aunt=null;
		Integer sum=0;
		String tem_aunt_id=request.getParameter("aunt_id");
		Integer aunt_id=0;
		if(tem_aunt_id!=null && !tem_aunt_id.equals("")){
			aunt_id=Integer.parseInt(tem_aunt_id);
		}
		try {
			tpl =us.getTemplate();
			auntList=ss.getAuntList(pageNo, pageSize, null);
			sum=ss.getAuntCount(null);
			aunt=ss.getAuntById(aunt_id);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			commetnList=ss.getCommentByCmsId(1, 4, null,aunt.getId().toString(),"0");
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		aunt.setComList(commetnList);
		request.setAttribute("auntList",auntList);
		if(sum%pageSize==0){
			request.setAttribute("sum",sum/pageSize);
		}else{
			request.setAttribute("sum",sum/pageSize+1);
		}
		request.setAttribute("aunt",aunt);
		request.setAttribute("pageNo",pageNo);
		jsp= "/template/"+tpl.getFolder()+"/page/aunt_detail.jsp";//前台的手机jsp页面
		RequestDispatcher rd = request.getRequestDispatcher(jsp);
		rd.forward(request,response);
	}

	/**
	 * 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
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet( request,  response);
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}
最近下载更多
fei3655  LV6 2022年9月20日
admin115  LV6 2022年5月24日
monan111  LV2 2022年3月2日
duizhang  LV5 2022年2月19日
houliukou  LV37 2022年1月18日
I哎I呀I呀I  LV3 2021年11月22日
开心阿楠  LV5 2021年9月18日
zwbshuai  LV13 2021年8月26日
newbag  LV9 2021年8月9日
坑外有坑  LV1 2021年5月21日
最近浏览更多
fuyouou  LV5 3月14日
pumpkin_77 1月20日
暂无贡献等级
axdfer 1月4日
暂无贡献等级
asddwh  LV12 2023年12月26日
hanzhuohong  LV1 2023年12月25日
微信网友_6786215447367680  LV4 2023年12月23日
秦sir3067683450  LV10 2023年10月15日
2036495585  LV9 2023年10月6日
hym111 2023年7月15日
暂无贡献等级
asadda  LV2 2023年6月26日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友