JavaScud | Forum | JIRA | Blog |
  Dashboard > WebWork2文档中文化计划 > ... > Result Types > Dispatcher Result
  WebWork2文档中文化计划 Log In View a printable version of the current page.  
  Dispatcher Result
Added by scud, last edited by 黑灵 on May 03, 2006  (view change)
Labels: 
(None)

Include或者Forward到一个视图(通常是JSP). 在背后WebWork是用RequestDispatcher来实现的, 在RequestDispatcher里目标servlet/JSP得到与原始的servlet/JSP同样的request/response对象. 因此, 你可以用request.setAttribute()在他们之间传递数据 - WebWork的action可用.

Result可以有三种执行方式:

  • 如果我们在一个JSP的范围内(PageContext对象可用), PageContext的include(String)方法会被调用.
  • 如果没有PageContext对象, 并且我们也不在任何形式的include中(在request的属性中没有"javax.servlet.include.servlet_path"), 那么调用RequestDispatcher的forward方法
  • 否则调用RequestDispatcher的include方法

参数

  • location (默认) - 执行后转到的地方(如 jsp).
  • parse - 默认为true. 如果设置为false, location 参数就不会被解析为Ognl表达式.

例子

<result name="success" type="dispatcher">
  <param name="location">foo.jsp</param>
</result>
Site running on a free Atlassian Confluence Open Source Project License granted to WebWork China. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.3 Build:#808 May 29, 2007) - Bug/feature request - Contact Administrators