📄 shoppingservlet.java
字号:
/*
* Created on 2005-3-11
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package shopping;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
public class ShoppingServlet extends HttpServlet {
private HashMap names;
private HashMap cards;
public void init(ServletConfig config) throws ServletException {
super.init(config);
System.out.println("in servlet init");
names = new HashMap();
cards = new HashMap();
Enumeration en = config.getInitParameterNames();
while (en.hasMoreElements()) {
String name = (String) en.nextElement();
System.out.println(name);
if (name.startsWith("name-")) {
names.put(name.substring(5), config.getInitParameter(name));
} else {
cards.put(name, config.getInitParameter(name));
}
}
}
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
BusinessProcess process = new BusinessProcess();
process.processRequest(request, response, names, cards);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -