Improve annotation based example
Project: http://git-wip-us.apache.org/repos/asf/struts-examples/repo Commit: http://git-wip-us.apache.org/repos/asf/struts-examples/commit/ddd45ff4 Tree: http://git-wip-us.apache.org/repos/asf/struts-examples/tree/ddd45ff4 Diff: http://git-wip-us.apache.org/repos/asf/struts-examples/diff/ddd45ff4 Branch: refs/heads/master Commit: ddd45ff49d502c993a8d272524a7db3df140e3a1 Parents: a183bf5 Author: Johannes Geppert <jo...@apache.org> Authored: Mon Oct 5 20:05:38 2015 +0200 Committer: Johannes Geppert <jo...@apache.org> Committed: Mon Oct 5 20:05:38 2015 +0200 ---------------------------------------------------------------------- annotations/pom.xml | 14 +++++++++----- .../webapp/WEB-INF/content/hello-success.jsp | 19 ++++++++++--------- .../src/main/webapp/WEB-INF/content/index.jsp | 20 +++++++++++++++++++- .../webapp/WEB-INF/content/register-input.jsp | 17 +++++++++-------- .../webapp/WEB-INF/content/register-success.jsp | 17 +++++++++-------- annotations/src/main/webapp/WEB-INF/web.xml | 8 ++++---- annotations/src/main/webapp/index.jsp | 20 +------------------- 7 files changed, 61 insertions(+), 54 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts-examples/blob/ddd45ff4/annotations/pom.xml ---------------------------------------------------------------------- diff --git a/annotations/pom.xml b/annotations/pom.xml index 98a1d45..4e238b5 100644 --- a/annotations/pom.xml +++ b/annotations/pom.xml @@ -28,16 +28,20 @@ <finalName>annotations</finalName> <plugins> <plugin> - <groupId>org.mortbay.jetty</groupId> + <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> - <version>8.1.16.v20140903</version> + <version>9.3.3.v20150827</version> <configuration> + <webApp> + <contextPath>/${artifactId}</contextPath> + </webApp> <stopKey>CTRL+C</stopKey> <stopPort>8999</stopPort> <scanIntervalSeconds>10</scanIntervalSeconds> - <scanTargets> - <scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget> - </scanTargets> + <webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory> + <webAppConfig> + <descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor> + </webAppConfig> </configuration> </plugin> </plugins> http://git-wip-us.apache.org/repos/asf/struts-examples/blob/ddd45ff4/annotations/src/main/webapp/WEB-INF/content/hello-success.jsp ---------------------------------------------------------------------- diff --git a/annotations/src/main/webapp/WEB-INF/content/hello-success.jsp b/annotations/src/main/webapp/WEB-INF/content/hello-success.jsp index b02f233..5fdf21d 100644 --- a/annotations/src/main/webapp/WEB-INF/content/hello-success.jsp +++ b/annotations/src/main/webapp/WEB-INF/content/hello-success.jsp @@ -1,18 +1,19 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> +<!DOCTYPE html> +<%@ page contentType="text/html; charset=UTF-8" %> <%@ taglib prefix="s" uri="/struts-tags" %> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1" %> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> +<html lang="en"> <head> - <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> - <title>Hello</title> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>Basic Struts 2 Application - Hello</title> </head> + <body> <h3><s:property value="message"/></h3> - -<p><a href="index.jsp">Return to home page</a>.</p> +<p><a href="<s:url action='index' />">Return to home page</a>.</p> </body> </html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts-examples/blob/ddd45ff4/annotations/src/main/webapp/WEB-INF/content/index.jsp ---------------------------------------------------------------------- diff --git a/annotations/src/main/webapp/WEB-INF/content/index.jsp b/annotations/src/main/webapp/WEB-INF/content/index.jsp index 08ef1fc..c24af42 100644 --- a/annotations/src/main/webapp/WEB-INF/content/index.jsp +++ b/annotations/src/main/webapp/WEB-INF/content/index.jsp @@ -1 +1,19 @@ -<% response.sendRedirect("/index.jsp"); %> \ No newline at end of file +<!DOCTYPE html> +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<html lang="en"> +<head> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>Basic Struts 2 Application - Welcome</title> +</head> +<body> +<h1>Welcome To Struts 2!</h1> + +<p><a href="<s:url action='hello' />" >Get your hello.</a></p> +<p><a href="<s:url action='register-input' />" > Register for the drawing.</a></p> + +</body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts-examples/blob/ddd45ff4/annotations/src/main/webapp/WEB-INF/content/register-input.jsp ---------------------------------------------------------------------- diff --git a/annotations/src/main/webapp/WEB-INF/content/register-input.jsp b/annotations/src/main/webapp/WEB-INF/content/register-input.jsp index 7ec62b7..2c522b1 100644 --- a/annotations/src/main/webapp/WEB-INF/content/register-input.jsp +++ b/annotations/src/main/webapp/WEB-INF/content/register-input.jsp @@ -1,14 +1,15 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> +<!DOCTYPE html> +<%@ page contentType="text/html; charset=UTF-8" %> <%@ taglib prefix="s" uri="/struts-tags" %> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1" %> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> +<html lang="en"> <head> - <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> - <title>Register</title> - <s:head/> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>Basic Struts 2 Application - Register</title> </head> + <body> <h3>Register for a prize by completing this form.</h3> http://git-wip-us.apache.org/repos/asf/struts-examples/blob/ddd45ff4/annotations/src/main/webapp/WEB-INF/content/register-success.jsp ---------------------------------------------------------------------- diff --git a/annotations/src/main/webapp/WEB-INF/content/register-success.jsp b/annotations/src/main/webapp/WEB-INF/content/register-success.jsp index c9c0e52..f580941 100644 --- a/annotations/src/main/webapp/WEB-INF/content/register-success.jsp +++ b/annotations/src/main/webapp/WEB-INF/content/register-success.jsp @@ -1,19 +1,20 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> +<!DOCTYPE html> +<%@ page contentType="text/html; charset=UTF-8" %> <%@ taglib prefix="s" uri="/struts-tags" %> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1" %> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> +<html lang="en"> <head> - <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> - <title>Registration Successful</title> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>Basic Struts 2 Application - Registration Successful</title> </head> <body> <h3>Thank you for registering for a prize.</h3> <p>Your registration information: <s:property value="personBean"/></p> -<p><a href="index.jsp">Return to home page</a>.</p> +<p><a href="<s:url action='index' />">Return to home page</a>.</p> </body> </html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts-examples/blob/ddd45ff4/annotations/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/annotations/src/main/webapp/WEB-INF/web.xml b/annotations/src/main/webapp/WEB-INF/web.xml index 5faa02d..6b49ec1 100644 --- a/annotations/src/main/webapp/WEB-INF/web.xml +++ b/annotations/src/main/webapp/WEB-INF/web.xml @@ -3,10 +3,6 @@ xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>annotations</display-name> - <welcome-file-list> - <welcome-file>index.jsp</welcome-file> - </welcome-file-list> - <filter> <filter-name>struts2</filter-name> @@ -22,4 +18,8 @@ <url-pattern>/*</url-pattern> </filter-mapping> + <welcome-file-list> + <welcome-file>index.jsp</welcome-file> + </welcome-file-list> + </web-app> http://git-wip-us.apache.org/repos/asf/struts-examples/blob/ddd45ff4/annotations/src/main/webapp/index.jsp ---------------------------------------------------------------------- diff --git a/annotations/src/main/webapp/index.jsp b/annotations/src/main/webapp/index.jsp index 819511e..345dce0 100644 --- a/annotations/src/main/webapp/index.jsp +++ b/annotations/src/main/webapp/index.jsp @@ -1,19 +1 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib prefix="s" uri="/struts-tags" %> -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> -<title>Basic Struts 2 Application - Welcome</title> -</head> -<body> -<h1>Welcome To Struts 2!</h1> - -<p><a href="<s:url action='hello' />" >Get your hello.</a></p> -<p><a href="<s:url action='register-input' />" > Register for the drawing.</a></p> - - - -</body> -</html> \ No newline at end of file +<% response.sendRedirect("/index"); %>