THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
A very common use cases in web applications is linking to other pages. Now that we know Struts is up and running, let's add a Welcome page with links to other actions.
Panel |
---|
The Code
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> <h3>Languages</h3> <ul> <li> <s:url id="url" action="Welcome"> <s:param name="request_locale">en</s:param> </s:url> <s:a href="%{url}">English</s:a> </li> <li> <s:url id="url" action="Welcome"> <s:param name="request_locale">ja</s:param> </s:url> <s:a href="%{url}">Japanese</s:a> </li> </ul> </body> </html> |
...
Most applications will use several data entry forms. The Struts tags make creating input forms easy.
Panel |
---|
The Code
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<%@ taglib prefix="s" uri="/struts-tags" %> <html> <head> <title>Logon</title> </head> <body> <s:form action="Logon"> <s:textfield label="User Name" name="username"/> <s:password label="Password" name="password" showPassword="true"/> <s:submit/> </s:form> </body> </html> |
...