你的理解应该是对的可以有统一的一个Controler,然后呢?

解决方案 »

  1.   

    可以写多个controler,,也可以写一个整体的,一般来说都是先分这写,最后整合到一个里头的
      

  2.   

    那用forward()和sendRedirect()有什么不同?(即用转发和送302回码有什么不同?)
      

  3.   

    答案应该是这样:
    The main diffrence is that the forward one does the redirecting at the server side while the sendRedirect one redirects to a new URL at the client's side(the browser).The sendRedirect one also loses the request and response data you may have putin (like forms attributes etc) while the forward one doesn't.
      

  4.   

    javax.servlet.RequestDispatcher.forward() 
    只是把forward指想的url在本也执行,而不转移url
    而后者将彻底转移到send的url。
     
    一个应用可以有多个容器。
      

  5.   

    我这几天一直在使用这个,烦死了,我发现了些问题
    1RequestDispatcher.forward(),HttpServletResponse.sendRedirect()
    在servlet这条语句后,还会接着往下执行,为什么不是跳转离开呢?
    2.RequestDispatcher.forward(),使用request.setAttribute("as",as);
    数据根本传送不过去。
    3.在tomcat中,这两条语句传送的中文总是乱码,转码也转不成,烦透了。
    4.RequestDispatcher.forward(),使用的url必须是以"/"开始的我主要用这个来做servlet的异常处理,重定向到一个错误处理页面
    jsp用错误处理一般用<%@ page errorPage="../errorpage.jsp" %>但servlet好像没类型的错误机制
      

  6.   

    to NullGate(我爱小白) :
    我的经验,
    1、RequestDispatcher.forward(),HttpServletResponse.sendRedirect()后,页面中的其它应答就结束了,页面中后面的东西不会接着往下执行。
    2、request.setAttribute()是可以传数据至目标jsp页面或servlet的,要在目标页用request.getAttribute()接收
    3、你指的传送是以什么方式传送?uri后带?parm=xx方式吗?
    4、还是跟你不一样,我的反而是不应该以"/"开始,用"/"开始的话就不能正确的转发。
    我的环境是tomcat4