THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Welcome</title>
<link href="<s:url value="/css/tutorial.css"/>" rel="stylesheet"
type="text/css"/>
</head>
<body>
<h3>Commands</h3>
<ul>
<li><a href="<s:url action="Register"/>">Register</a></li>
<li><a href="<s:url action="Logon"/>">Sign On</a></li>
</ul>
</body>
</html>
|
Another common use case is using a link to change locales. On the HelloWorld page, let's add links to change the user's locale and to display a message from the application resources.
Panel |
---|
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<body> <h2><s:property value="message"/></h2> <h3>Languages</h3> <ul> <li> <s:url id="url" action="WelcomeHelloWorld"> <s:param name="request_locale">en</s:param> </s:url> <s:a href="%{url}">English</s:a> </li> <li> <s:url id="url" action="WelcomeHelloWorld"> <s:param name="request_locale">ja<>es</s:param> </s:url> <s:a href="%{url}">Japanese<>Espanol</s:a> </li> </ul> </body> </html> |
How the Code Works
On the Welcome pageand HelloWorld pages, we use two different Struts tags to create links. We create
...
Finally, in the Languages section on the HelloWorld page, we use the url
tag along with the param
and a
tags to create a link with request parameters.
...