|
Struts example source code file (actionPrefixExample.ftl)
This example Struts source code file (actionPrefixExample.ftl) is included in the DevDaily.com
"Java Source Code
Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.
The Struts actionPrefixExample.ftl source code
<html>
<head>
<title>Showcase - Tags - Non UI - Action Prefix (Freemarker)
</head>
<body>
<b>Action Prefix
By clicking on 'action prefix' button, the request will go to the action alias 'actionPrefix'
instead of the normal 'submit' action alias. <p/>
<b>Method Prefix
By clicking on the 'method prefix' button, the request will cause Struts to invoke 'submit'
action alias's 'alternateMethod' method instead of the default 'execute' method.<p/>
<b>Redirect Prefix
By clicking on the 'redirect prefix' button, the request will get redirected to www.google.com
instead<p/>
<b>Redirect Action Prefix
By clicking on the 'redirect-action prefix' button, the request will get redirected to
an action alias of 'redirectActionPrefix' instead of 'submit' action alias. Since this is a
redirect (a new request is issue from the client), the text entered will be lost.<p/>
<@s.url id="url" action="viewSource" namespace="/tags/non-ui/actionPrefix" />
The JSP code can be read <@s.a href="%{#url}">here.
<@s.form action="submit" namespace="/tags/non-ui/actionPrefix" method="POST">
<@s.textfield label="Enter Some Text" name="text" />
<@s.submit name="action:actionPrefix" value="%{'action prefix'}" />
<@s.submit name="method:alternateMethod" value="%{'method prefix'}" />
<@s.submit name="redirect:http://www.google.com" value="%{'redirect prefix'}" />
<@s.submit name="redirect-action:redirectActionPrefix" value="%{'redirect-action prefix'}" />
<@s.submit value="Normal Submit" />
<@s.submit name="action:redirectActionPrefixAction" value="%{'redirect-action without prefix'}" />
</@s.form>
</body>
</html>
Other Struts examples (source code examples)
Here is a short list of links related to this Struts actionPrefixExample.ftl source code file:
|