
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts.custom.i18n.resources" value="myapp" />
<package name="default" extends="struts-default" namespace="/">
<action name="welcome" class="com.dineshonjava.struts2.login.LoginAction">
<result name="success">/Welcome.jsp</result>
<result name="error">/Login.jsp</result>
</action>
</package>
<package name="login" extends="struts-default" namespace="/login">
<action name="welcome" class="com.dineshonjava.struts2.login.LoginAction">
<result name="success">/Welcome.jsp</result>
<result name="error">/Login.jsp</result>
</action>
</package>
<package name="welocome" extends="struts-default" namespace="/welcome">
<action name="welcome" class="com.dineshonjava.struts2.login.LoginAction">
<result name="success">/Welcome.jsp</result>
<result name="error">/Login.jsp</result>
</action>
</package>
</struts>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ 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>Welcome</title>
</head>
<body>
<h2>Default namespace</h2>
<h2>Hello Welcome , <s:property value="username" />...! Dineshonjava.com</h2>
</body>
</html>
<package name="default" extends="struts-default" namespace="/">
<action name="welcome" class="com.dineshonjava.struts2.login.LoginAction">
<result name="success">/Welcome.jsp</result>
<result name="error">/Login.jsp</result>
</action>
</package>

<%@ page contentType="text/html; charset=UTF-8"%>
<%@ 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>Welcome</title>
</head>
<body>
<h2>login namespace</h2>
<h2>Hello Welcome , <s:property value="username" />...! Dineshonjava.com</h2>
</body>
</html>
<package name="login" extends="struts-default" namespace="/login">
<action name="login" class="com.dineshonjava.struts2.login.LoginAction">
<result name="success">/Welcome.jsp</result>
<result name="error">/Login.jsp</result>
</action>
</package>

<%@ page contentType="text/html; charset=UTF-8"%>
<%@ 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>Welcome</title>
</head>
<body>
<h2>welcome namespace</h2>
<h2>Hello Welcome , <s:property value="username" />...! Dineshonjava.com</h2>
</body>
</html>
URL : http://localhost:8080/doj/welcome/welcome.action<package name="login" extends="struts-default" namespace="/welcome">
<action name="welcome" class="com.dineshonjava.struts2.login.LoginAction">
<result name="success">/Welcome.jsp</result>
<result name="error">/Login.jsp</result>
</action>
</package>

Labels: struts2