Commit 40ddf102 authored by Sowmik's avatar Sowmik

added tiles, bean, interceptors

parent a06d1ee2
This diff is collapsed.
......@@ -5,12 +5,21 @@
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="login" template="/layoutManager.jsp">
<definition name="index" template="/layoutManager.jsp">
<put-attribute name="title" value="Home Page"/>
<put-attribute name="body" value="/index.jsp"/>
</definition>
<definition name="login-success" template="/layoutManager.jsp">
<put-attribute name="title" value="Welcome Page"/>
<put-attribute name="body" value="/welcome.jsp"/>
</definition>
<definition name="login-error" template="/layoutManager.jsp">
<put-attribute name="title" value="Login Page"/>
<put-attribute name="body" value="/login.jsp"/>
</definition>
<definition name="registration" template="/layoutManager.jsp">
<definition name="registration-success" template="/layoutManager.jsp">
<put-attribute name="title" value="Registration Page"/>
<put-attribute name="body" value="/register.jsp"/>
</definition>
......
......@@ -23,11 +23,20 @@
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>
org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
</param-name>
<param-value>
/WEB-INF/tiles.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.apache.struts2.tiles.StrutsTilesListener
</listener-class>
</listener>
</listener>
</web-app>
\ No newline at end of file
<%-- <%@ page language="java" contentType="text/html; charset=ISO-8859-1" --%>
<%-- pageEncoding="ISO-8859-1"%> --%>
<!-- <!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>Insert title here</title> -->
<!-- </head> -->
<!-- <body> -->
<!-- </body> -->
<!-- </html> -->
<h3 style="background-color: blue; text-align: center;">This is footer. We may keep different types of links here in later.</h3>
<hr>
\ No newline at end of file
<%-- <%@ page language="java" contentType="text/html; charset=UTF-8" --%>
<%-- pageEncoding="UTF-8"%> --%>
<!-- <!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=UTF-8"> -->
<!-- <title>Insert title here</title> -->
<!-- </head> -->
<!-- <body> -->
<!-- </body> -->
<!-- </html> -->
<h3 style="background-color: green; text-align: center;">This is header. We may keep menu items here in later.</h3>
<hr>
\ No newline at end of file
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!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=UTF-8">
<title>Test project title</title>
</head>
<body>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!-- <!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=UTF-8"> -->
<!-- <title>Test project title</title> -->
<!-- </head> -->
<!-- <body> -->
<h1>Home Page</h1>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
......@@ -15,5 +17,5 @@
<a href="register.jsp">Register</a>
</body>
</html>
\ No newline at end of file
<!-- </body> -->
<!-- </html> -->
\ No newline at end of file
<%-- <%@ page language="java" contentType="text/html; charset=UTF-8" --%>
<%-- pageEncoding="UTF-8"%> --%>
<%-- <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %> --%>
<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -->
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<!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=UTF-8">
<title> <tiles:getAsString name="title" /> </title>
</head>
<body>
<%@ include file="header.jsp" %>
<tiles:insertAttribute name="body"/>
<%@ include file="footer.jsp" %>
</body>
</html>
\ No newline at end of file
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!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=UTF-8">
<title>Login</title>
</head>
<body>
<!-- <!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=UTF-8"> -->
<!-- <title>Login</title> -->
<!-- </head> -->
<!-- <body> -->
<h3>User Login</h3>
<form action="login" method="post">
<pre>
......@@ -23,5 +23,5 @@
%>
</form>
<a href="/registration.jsp">Register</a>
</body>
</html>
\ No newline at end of file
<!-- </body> -->
<!-- </html> -->
\ No newline at end of file
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!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=UTF-8">
<title>User Registration Title</title>
</head>
<body>
<!-- <!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=UTF-8"> -->
<!-- <title>User Registration Title</title> -->
<!-- </head> -->
<!-- <body> -->
<h3>User Registration</h3>
<form action="register" method="post">
<pre>
......@@ -25,5 +25,5 @@
%>
</form>
<a href="/login.jsp">Login</a>
</body>
</html>
\ No newline at end of file
<!-- </body> -->
<!-- </html> -->
\ No newline at end of file
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!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=UTF-8">
<title>Welcome Page Title</title>
</head>
<body>
<!-- <!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=UTF-8"> -->
<!-- <title>Welcome Page Title</title> -->
<!-- </head> -->
<!-- <body> -->
<h4>Welcome To Nepal</h4>
<s:bean name="test.Login" var="hello_bin">
<s:param name="message">Hello, this is bean tag!</s:param>
</s:bean>
<%-- <s:bean name="test.Login" var="hello_bin"> --%>
<%-- <s:param name="message">Hello, this is bean tag!</s:param> --%>
<%-- </s:bean> --%>
<s:property value="message"/>
<p>Bean tage message property value is: <s:property value="hello_bin.message"/> </p>
<%-- <p>Bean tage message property value is: <s:property value="hello_bin.message"/> </p> --%>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</body>
</html>
\ No newline at end of file
<!-- </body> -->
<!-- </html> -->
\ No newline at end of file
......@@ -5,9 +5,13 @@
<struts>
<constant name="struts.devMode" value="true"/>
<package name="test" extends="tiles-default" namespace="/">
<!--This is a comment: extends="struts-default" -->
<package name="test" extends="struts-default">
<result-types>
<result-type name = "tiles"
class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<interceptors>
<interceptor-stack name="appDefault">
<interceptor-ref name="timer" />
......@@ -20,21 +24,37 @@
<default-interceptor-ref name="appDefault" />
<action name="index">
<result>/index.jsp</result>
</action>
<!-- <action name="index"> -->
<!-- <result>/index.jsp</result> -->
<!-- </action> -->
<action name="login" class="test.LoginAction" method="execute">
<interceptor-ref name="timer"/>
<interceptor-ref name="appDefault"/>
<!-- <action name="login" class="test.LoginAction" method="execute"> -->
<!-- <interceptor-ref name="timer"/> -->
<!-- <interceptor-ref name="appDefault"/> -->
<result name="SUCCESS">/welcome.jsp</result>
<result name="FAILURE">/login.jsp</result>
</action>
<!-- <result name="SUCCESS">/welcome.jsp</result> -->
<!-- <result name="FAILURE">/login.jsp</result> -->
<!-- </action> -->
<!-- <action name="register" class="test.RegistrationAction"> -->
<!-- <interceptor-ref name="upper" /> -->
<!-- <result name="SUCCESS">/welcome.jsp</result> -->
<!-- </action> -->
<!-- after adding tiles -->
<!-- <action name="index"> -->
<!-- <result name="index" type="tiles">index</result> -->
<!-- </action> -->
<action name="login" class="test.LoginAction">
<result name="SUCCESS" type="tiles">login-success</result>
<result name="FAILURE" type="tiles">login-error</result>
</action>
<action name="register" class="test.RegistrationAction">
<interceptor-ref name="upper" />
<result name="SUCCESS">/welcome.jsp</result>
<result name="SUCCESS" type="tiles">registration-success</result>
</action>
</package>
</struts>
\ No newline at end of file
......@@ -5,9 +5,13 @@
<struts>
<constant name="struts.devMode" value="true"/>
<package name="test" extends="tiles-default" namespace="/">
<!--This is a comment: extends="struts-default" -->
<package name="test" extends="struts-default">
<result-types>
<result-type name = "tiles"
class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<interceptors>
<interceptor-stack name="appDefault">
<interceptor-ref name="timer" />
......@@ -20,21 +24,37 @@
<default-interceptor-ref name="appDefault" />
<action name="index">
<result>/index.jsp</result>
</action>
<!-- <action name="index"> -->
<!-- <result>/index.jsp</result> -->
<!-- </action> -->
<action name="login" class="test.LoginAction" method="execute">
<interceptor-ref name="timer"/>
<interceptor-ref name="appDefault"/>
<!-- <action name="login" class="test.LoginAction" method="execute"> -->
<!-- <interceptor-ref name="timer"/> -->
<!-- <interceptor-ref name="appDefault"/> -->
<result name="SUCCESS">/welcome.jsp</result>
<result name="FAILURE">/login.jsp</result>
</action>
<!-- <result name="SUCCESS">/welcome.jsp</result> -->
<!-- <result name="FAILURE">/login.jsp</result> -->
<!-- </action> -->
<!-- <action name="register" class="test.RegistrationAction"> -->
<!-- <interceptor-ref name="upper" /> -->
<!-- <result name="SUCCESS">/welcome.jsp</result> -->
<!-- </action> -->
<!-- after adding tiles -->
<!-- <action name="index"> -->
<!-- <result name="index" type="tiles">index</result> -->
<!-- </action> -->
<action name="login" class="test.LoginAction">
<result name="SUCCESS" type="tiles">login-success</result>
<result name="FAILURE" type="tiles">login-error</result>
</action>
<action name="register" class="test.RegistrationAction">
<interceptor-ref name="upper" />
<result name="SUCCESS">/welcome.jsp</result>
<result name="SUCCESS" type="tiles">registration-success</result>
</action>
</package>
</struts>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment