index.jsp:

<a href="product-input.action">input</a>

<form action="product-save.action" method="post">
ProductName:<input type="text" name="productName"/><br>
productDesc:<input type="text" name="productDesc"/><br>
productPrice:<input type="text" name="productPrice"/><br>
<input type="submit" name="submit" value="submit">
</form>

details.jsp:

productId:${product.productId}

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
// TODO Auto-generated method stub
// place your code here
HttpServletRequest req=(HttpServletRequest) request;
String servletPath = req.getServletPath();
System.out.println(servletPath);
String path = null;
if("/product-input.action".equals(servletPath)){
path="/WEB-INF/pages/input.jsp";
}
if("/product-save.action".equals(servletPath)){
String productName = request.getParameter("productName");
String productDesc = request.getParameter("productDesc");
String productPrice = request.getParameter("productPrice");
Product product = new Product(null, productName, productDesc, productPrice);
product.setProductId(1001);
System.out.println(product);
request.setAttribute("product", product);
path = "/WEB-INF/pages/details.jsp";
}
if(path!=null){
request.getRequestDispatcher(path).forward(request, response);
return;
}
// pass the request along the filter chain
chain.doFilter(request, response);
} filterDispatcher

最新文章

  1. 总结30个CSS3选择器
  2. 【转载】Java集合类Array、List、Map区别和联系
  3. Facebook 的系统架构(转)
  4. ORACLE 对用户密码做限制
  5. 《head first java 》读书笔记(五)
  6. HDU1398Square Coins(母函数)
  7. SGU 134.Centroid(图心)
  8. HYSBZ 2818 gcd
  9. 【LigerUI】ajax请求firefox返回NS_BINDING_ABORTED
  10. 基于visual Studio2013解决C语言竞赛题之0904文件排序
  11. 芝麻HTTP:Python爬虫进阶之Scrapy框架安装配置
  12. MySQL中的数值函数
  13. set 数据类型
  14. tool 使用font-spider解决字体压缩问题
  15. [luogu3377][左偏树(可并堆)]
  16. xshell无法在小键盘输入数字
  17. view之Scroller工具类和GestureDetector的简单用法
  18. mysql网课部分笔记
  19. ZOJ3180 Number Game
  20. 转载、Python的编码处理(二)

热门文章

  1. Pacemaker详解
  2. 算法寒假实习面试经过之 滴滴(电话一面二面 offer)
  3. 自定义Cell需要注意的问题
  4. Service degrade
  5. Struts2笔记01——基础MVC架构(转)
  6. verilog FAQ(zz)
  7. tomcat 正常启动但不能访问
  8. FIND_IN_SET的简单使用
  9. Kafaka高可用集群环境搭建
  10. jar 冲突解决方案