This is an automated email from the ASF dual-hosted git repository. amashchenko pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts-site.git
The following commit(s) were added to refs/heads/master by this push: new dc40157 fix some result types pages dc40157 is described below commit dc40157cdd11131126332cfabb82842a5f9daea0 Author: Aleksandr Mashchenko <amashche...@apache.org> AuthorDate: Fri Sep 22 23:07:30 2017 +0300 fix some result types pages --- source/core-developers/chain-result.md | 58 ++++++++++++++++++----------- source/core-developers/dispatcher-result.md | 26 +++++++------ source/core-developers/freemarker-result.md | 58 ++++++----------------------- source/core-developers/httpheader-result.md | 32 ++++++++++------ source/core-developers/result-types.md | 2 +- 5 files changed, 82 insertions(+), 94 deletions(-) diff --git a/source/core-developers/chain-result.md b/source/core-developers/chain-result.md index 4258ff4..4eec90d 100644 --- a/source/core-developers/chain-result.md +++ b/source/core-developers/chain-result.md @@ -5,25 +5,39 @@ title: Chain Result # Chain Result - - -~~~~~~~ -{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.ActionChainResult} -~~~~~~~ - -####Parameters#### - - - -~~~~~~~ -{snippet:id=params|javadoc=true|url=com.opensymphony.xwork2.ActionChainResult} -~~~~~~~ - -####Examples#### - - - -~~~~~~~ -{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.xwork2.ActionChainResult} -~~~~~~~ - +This result invokes an entire other action, complete with it's own interceptor stack and result. + +### Parameters + +- `actionName` (default) - the name of the action that will be chained to. + +- `namespace` - used to determine which namespace the Action is in that we're chaining. If namespace is null, this defaults to the current namespace. + +- `method` - used to specify another method on target action to be invoked. If null, this defaults to execute method. + +- `skipActions` - (optional) the list of comma separated action names for the actions that could be chained to. + +### Examples + +``` +<package name="public" extends="struts-default"> + <!-- Chain creatAccount to login, using the default parameter --> + <action name="createAccount" class="..."> + <result type="chain">login</result> + </action> + + <action name="login" class="..."> + <!-- Chain to another namespace --> + <result type="chain"> + <param name="actionName">dashboard</param> + <param name="namespace">/secure</param> + </result> + </action> +</package> + +<package name="secure" extends="struts-default" namespace="/secure"> + <action name="dashboard" class="..."> + <result>dashboard.jsp</result> + </action> +</package> +``` diff --git a/source/core-developers/dispatcher-result.md b/source/core-developers/dispatcher-result.md index f3f4279..371f768 100644 --- a/source/core-developers/dispatcher-result.md +++ b/source/core-developers/dispatcher-result.md @@ -5,24 +5,26 @@ title: Dispatcher Result # Dispatcher Result +Includes or forwards to a view (usually a jsp). Behind the scenes Struts will use a `RequestDispatcher`, where the target servlet/JSP receives the same request/response objects as the original servlet/JSP. Therefore, you can pass data between them using `request.setAttribute()` - the Struts action is available. +There are three possible ways the result can be executed: -~~~~~~~ -{snippet:id=description|javadoc=true|url=org.apache.struts2.result.ServletDispatcherResult} -~~~~~~~ +- If we are in the scope of a JSP (a PageContext is available), PageContext's `{@link PageContext#include(String) include}` method is called. -#####Parameters##### +- If there is no PageContext and we're not in any sort of include (there is no "javax.servlet.include.servlet_path" in the request attributes), then a call to `{@link RequestDispatcher#forward(javax.servlet.ServletRequest, javax.servlet.ServletResponse) forward}` is made. +- Otherwise, `{@link RequestDispatcher#include(javax.servlet.ServletRequest, javax.servlet.ServletResponse) include}` is called. +#### Parameters -~~~~~~~ -{snippet:id=params|javadoc=true|url=org.apache.struts2.result.ServletDispatcherResult} -~~~~~~~ +- `location` (default) - the location to go to after execution (ex. jsp). -#####Examples##### +- `parse` - true by default. If set to false, the location param will not be parsed for OGNL expressions. +#### Examples - -~~~~~~~ -{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.result.ServletDispatcherResult} -~~~~~~~ +``` +<result name="success" type="dispatcher"> + <param name="location">foo.jsp</param> +</result> +``` diff --git a/source/core-developers/freemarker-result.md b/source/core-developers/freemarker-result.md index 1af5b44..d456eb4 100644 --- a/source/core-developers/freemarker-result.md +++ b/source/core-developers/freemarker-result.md @@ -5,63 +5,27 @@ title: FreeMarker Result # FreeMarker Result -Renders a view using the Freemarker template engine\. The +Renders a view using the Freemarker template engine. The `FreemarkarManager` class configures the template loaders so that the template location can be either -~~~~~~~ -FreemarkarManager -~~~~~~~ - class configures the template loaders so that the template location can be either +- relative to the web root folder, e.g.: `/WEB-INF/views/home.ftl` -+ relative to the web root folder, e\.g\.: +- a classpath resource, e.g.: `/com/company/web/views/home.ftl` -~~~~~~~ -/WEB-INF/views/home.ftl -~~~~~~~ - -+ a classpath resource, e\.g\.: - -~~~~~~~ -/com/company/web/views/home.ftl -~~~~~~~ - - Also see [Freemarker Support](freemarker-support.html). -#####Parameters##### - -+ **location** (default) \- the location of the template to process\. - -+ **parse **\- true by default\. If set to false, the location param will not be parsed for expressions\. - -+ **contentType** \- defaults to - -~~~~~~~ -text/html -~~~~~~~ - unless specified\. - -+ **writeIfCompleted** \- - -~~~~~~~ -false -~~~~~~~ - by default, write to stream only if there isn't any error processing the template\. Setting +#### Parameters -~~~~~~~ -template_exception_handler=rethrow -~~~~~~~ - in +- `location` (default) - the location of the template to process. -~~~~~~~ -freemarker.properties -~~~~~~~ - will have the same effect\. +- `parse`- true by default. If set to false, the location param will not be parsed for expressions. -#####Examples##### +- `contentType` - defaults to `text/html` unless specified. +- `writeIfCompleted` - `false` by default, write to stream only if there isn't any error processing the template. Setting `template_exception_handler=rethrow` in `freemarker.properties` will have the same effect. +#### Examples -~~~~~~~ +``` <result name="success" type="freemarker">foo.ftl</result> -~~~~~~~ +``` diff --git a/source/core-developers/httpheader-result.md b/source/core-developers/httpheader-result.md index abbb275..63c52e7 100644 --- a/source/core-developers/httpheader-result.md +++ b/source/core-developers/httpheader-result.md @@ -5,24 +5,32 @@ title: HttpHeader Result # HttpHeader Result +A custom Result type for setting HTTP headers and status by optionally evaluating against the ValueStack. This result can also be used to send an error to the client. All the parameters can be evaluated against the ValueStack. +### Parameters -~~~~~~~ -{snippet:id=description|javadoc=true|url=org.apache.struts2.result.HttpHeaderResult} -~~~~~~~ -####Parameters#### +- `status` - the http servlet response status code that should be set on a response. +- `parse` - true by default. If set to false, the headers param will not be parsed for Ognl expressions. +- `headers` - header values. -~~~~~~~ -{snippet:id=params|javadoc=true|url=org.apache.struts2.result.HttpHeaderResult} -~~~~~~~ +- `error` - the http servlet response error code that should be set on a response. -####Examples#### +- `errorMessage` - error message to be set on response if 'error' is set. +### Examples - -~~~~~~~ -{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.result.HttpHeaderResult} -~~~~~~~ +``` +<result name="success" type="httpheader"> + <param name="status">204</param> + <param name="headers.a">a custom header value</param> + <param name="headers.b">another custom header value</param> +</result> + +<result name="proxyRequired" type="httpheader"> + <param name="error">305</param> + <param name="errorMessage">this action must be accessed through a proxy</param> +</result> +``` diff --git a/source/core-developers/result-types.md b/source/core-developers/result-types.md index 7cab0a5..8c0d502 100644 --- a/source/core-developers/result-types.md +++ b/source/core-developers/result-types.md @@ -15,7 +15,7 @@ The framework provides several implementations of the `com.opensymphony.xwork2.R own applications. |[Chain Result](chain-result.html)|Used for [Action Chaining](action-chaining.html)| -|[Dispatcher Result](dispatcher-reult.html)|Used for web resource integration, including _JSP_ integration| +|[Dispatcher Result](dispatcher-result.html)|Used for web resource integration, including _JSP_ integration| |[FreeMarker Result](freemarker-result.html)|Used for _FreeMarker_ integration| |[HttpHeader Result](httpheader-result.html)|Used to control special HTTP behaviors| |[Redirect Result](redirect-result.html)|Used to redirect to another URL (web resource)| -- To stop receiving notification emails like this one, please contact ['"commits@struts.apache.org" <commits@struts.apache.org>'].