JSP support in WebWork is very easy: by default actionThe default configuration (struts-default.xml) configures the Dispatcher Result as the default result (see Result Types). This means any , which works well with JavaServer Pages. Any JSP 1.2+ container can work with WebWork Struts 2 JSP tags immediately.
Getting Started
Because JSP support occurs through the Dispatcher Result, which is the default result type, you don't need to specify the type attribute when configuration configuring struts.xml:
Code Block | ||||
---|---|---|---|---|
| ||||
<action name="test" class="com.acme.TestAction"> <result name="success">test-success.jsp</result> </action> |
...
Code Block | ||||
---|---|---|---|---|
| ||||
<%@ taglib prefix="wws" uri="webwork/struts-tags" %> <html> <head> <title>Hello</title> </head> <body> Hello, <ww<s:property value="name"/> </body> </html> |
...
The following are ways to obtained obtain Application scope attributes, Session scope attributes, Request scope attributes, Request parameters and framework Context scope parameters:-
...
Assuming there's an attribute with name 'myApplicationAttribute' in the Application scope.
Code Block |
---|
<saf<s:property value="%{#application.myApplicationAttribute}" /> |
...
Assuming there's an attribute with name 'mySessionAttribute' in the Session scope.
Code Block |
---|
<saf<s:property value="%{#session.mySessionAttribute}" /> |
...
Assuming there's an attribute with name 'myRequestAttribute' in the Request scope.
Code Block |
---|
<saf<s:property value="%{#request.myRequestAttribute}" /> |
...
Assuming there's a request parameter myParameter (ege.g. http://host/myApp/myAction.action?myParameter=one).
Code Block |
---|
<saf<s:property value="%{#parameters.myParameter}" /> |
...
Context Scope Parameter
Assuming there's a parameter with the name myContextParam in SAF our context.
Code Block |
---|
<saf<s:property value="%{#myContextParam}" /> |
...
See the JSP Tags documentation for information on how to use the generic Struts Tags provided by the framework.
...