diff --git a/apps/blank/src/main/java/org/apache/struts2/example/HomeAction.java b/apps/blank/src/main/java/example/Welcome.java similarity index 58% rename from apps/blank/src/main/java/org/apache/struts2/example/HomeAction.java rename to apps/blank/src/main/java/example/Welcome.java index 130d50a56..8d1b95f37 100644 --- a/apps/blank/src/main/java/org/apache/struts2/example/HomeAction.java +++ b/apps/blank/src/main/java/example/Welcome.java @@ -15,24 +15,43 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.struts2.example; +package example; import com.opensymphony.xwork2.ActionSupport; /** - * HomeAction + * Set welcome message. * */ -public class HomeAction extends ActionSupport { +public class Welcome extends ActionSupport { private static final long serialVersionUID = -3881551454078687096L; - /** - * A default implementation that does nothing an returns "success". - * - * @return {@link #SUCCESS} - */ + public static final String MESSAGE = "Struts is up and running ..."; + public String execute() throws Exception { + setMessage(MESSAGE); return SUCCESS; } + + /** + * Field for Message property. + */ + private String message; + + /** + * Return Message property. + * @return Message property + */ + public String getMessage() { + return message; + } + + /** + * Set Message property. + * @param message Text to display on Welcome page. + */ + public void setMessage(String message){ + this.message = message; + } } diff --git a/apps/blank/src/main/resources/struts.xml b/apps/blank/src/main/resources/struts.xml index 558f7f9bc..78bad2ac1 100644 --- a/apps/blank/src/main/resources/struts.xml +++ b/apps/blank/src/main/resources/struts.xml @@ -5,12 +5,10 @@ - + - - - - /WEB-INF/pages/home.jsp + + /example/{1}.jsp diff --git a/apps/blank/src/main/webapp/WEB-INF/pages/home.jsp b/apps/blank/src/main/webapp/example/Welcome.jsp similarity index 74% rename from apps/blank/src/main/webapp/WEB-INF/pages/home.jsp rename to apps/blank/src/main/webapp/example/Welcome.jsp index a0477e714..788732a62 100644 --- a/apps/blank/src/main/webapp/WEB-INF/pages/home.jsp +++ b/apps/blank/src/main/webapp/example/Welcome.jsp @@ -5,6 +5,6 @@ Welcome -

Struts is up and running...

+

diff --git a/apps/blank/src/main/webapp/index.jsp b/apps/blank/src/main/webapp/index.jsp index a370898ae..ce45af4c0 100644 --- a/apps/blank/src/main/webapp/index.jsp +++ b/apps/blank/src/main/webapp/index.jsp @@ -1 +1 @@ -<% response.sendRedirect(request.getContextPath() + "/home.action"); %> +<% response.sendRedirect(request.getContextPath() + "/Welcome.action"); %> diff --git a/apps/blank/src/test/java/org/apache/struts2/example/HomeActionTest.java b/apps/blank/src/test/java/example/WelcomeTest.java similarity index 56% rename from apps/blank/src/test/java/org/apache/struts2/example/HomeActionTest.java rename to apps/blank/src/test/java/example/WelcomeTest.java index b9dcf597e..1c7cfce06 100644 --- a/apps/blank/src/test/java/org/apache/struts2/example/HomeActionTest.java +++ b/apps/blank/src/test/java/example/WelcomeTest.java @@ -1,31 +1,36 @@ -/* - * $Id$ - * - * Copyright 2006 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.struts2.example; - -import junit.framework.TestCase; - -/** - * HomeActionTest - * - */ -public class HomeActionTest extends TestCase { - - public void testHomeAction() throws Exception { - assertTrue(true); - } -} +/* + * $Id: WelcomeTest.java 418530 2006-07-01 23:58:13Z mrdon $ + * + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package example; + +import junit.framework.TestCase; +import com.opensymphony.xwork2.Action; +import com.opensymphony.xwork2.ActionSupport; + +/** + * WelcomeTest + * + */ +public class WelcomeTest extends TestCase { + + public void testWelcome() throws Exception { + Action welcome = new Welcome(); + String result = welcome.execute(); + assertTrue(ActionSupport.SUCCESS.equals(result)); + assertTrue(welcome.equals(Welcome.MESSAGE)); + } +}