⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addbidaction.java

📁 是一个基于java开发的拍卖系统 非常适合初学者看
💻 JAVA
字号:
package com.wish.jhk.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

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 com.wish.jhk.action.form.AddBidForm;
import com.wish.jhk.service.impl.AuctionManagerImpl;
import com.wish.jhk.util.BeanFactory;

public class AddBidAction extends Action {
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest req, HttpServletResponse resp) throws Exception {
		AddBidForm addbidform = (AddBidForm) form;
		ActionForward forward = new ActionForward();
		AuctionManagerImpl auctionmanager = (AuctionManagerImpl) BeanFactory
		.getBean("auctionmanager");
		try {
			System.out.println(req.getSession().getAttribute("userId"));
			System.out.println(addbidform.getPrice());
			System.out.println(req.getParameter("itemId"));
			System.out.println(req.getParameter("maxPrice"));

			auctionmanager.addBid((Integer) req.getSession().getAttribute(
					"userId"), Integer.parseInt(req.getParameter("itemId")),
					addbidform.getPrice());

			forward.setPath("/viewjsp/viewBid.do");
		} catch (Exception e) {
			e.printStackTrace();
			req.setAttribute("exception", e.getMessage());
			forward.setPath("/error.jsp");
		}
		return forward;
	}
	
}

⌨️ 快捷键说明

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