📄 bid.java
字号:
package webauction.web.action;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.*;
import webauction.ejb.*;
import webauction.web.WebConstants;
import webauction.web.javabean.*;
public class Bid extends HttpServlet {
public void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
ServletContext sc = getServletContext();
WebAuction webAuction =
(WebAuction) sc.getAttribute(WebConstants.SC_ATTRIB_WEBAUCTION);
try {
String itemStr = req.getParameter("id");
int itemId = Integer.parseInt(itemStr);
ItemValueHolder item = webAuction.getItemWithId(itemId);
req.setAttribute("item", item);
PageBean pageBean = new PageBean();
pageBean.setTitle("WebLogic Auction");
pageBean.setBody("jsp/enterbid.jsp");
req.setAttribute("pageBean", pageBean);
} catch (NumberFormatException e) {
PageBean pageBean = new PageBean();
pageBean.setTitle("WebLogic Auction");
pageBean.setBody("jsp/main.jsp");
req.setAttribute("pageBean", pageBean);
e.printStackTrace();
} catch (NoSuchItemException e) {
PageBean pageBean = new PageBean();
pageBean.setTitle("WebLogic Auction");
pageBean.setBody("jsp/main.jsp");
req.setAttribute("pageBean", pageBean);
e.printStackTrace();
}
RequestDispatcher rd = sc.getNamedDispatcher("template");
rd.forward(req, res);
return;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -