s:url tags are not being replaced to html code when using a decorator with sitemesh. In the next example will be correctly explained.
web.xml:
[...]
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
WEB-INF/security-context.xml
WEB-INF/applicationContext.xml
</param-value>
</context-param>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
</filter>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter>
<filter-name>struts-cleanup</filter-name>
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
[...]
</web-app>
Login.jsp:
<%# page language="java" contentType="text/html; charset=ISO-8859-15" pageEncoding="ISO-8859-15"%>
<%# taglib prefix="s" uri="/struts-tags" %>
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
**<link rel="stylesheet" type="text/css" href="<s:url value="/style/global.css" />" />**
[...]
Layout.jsp: (my sitemesh decorator)
<%# page language="java" contentType="text/html; charset=ISO-8859-15" pageEncoding="ISO-8859-15"%>
<%# taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<%# taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %>
<%#taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%# 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-15">
**<link rel="stylesheet" type="text/css" href="<s:url value="/style/global.css" />" />**
</head>
[...]
The result HTML:
<?xml version="1.0" encoding="UTF-8" ?>
<!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">
<head>
<title>Café Mirabeau</title>
**<link rel="stylesheet" type="text/css" href="<s:url value='/style/global.css' />"** />
</head>
<body>
<h1>Header</h1>
<p><b>Navigation</b></p>
<hr />
**<link rel="stylesheet" type="text/css" href="/(myapp)/style/global.css" />**
As you can see, the same line is on the login.jsp and on layout.jsp, but only on login.jsp is correctly replaced.
Anyone knows what can be happening?
Try putting your struts2 filter:
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
before the sitemesh filter
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
in your web.xml.
Related
I'm attempting to integrate Struts2 ver 2.5.2, DWR ver 2.0,5, and Sitemesh ver 2.5. My DWR is (almost) already work fine. I can open [CONTEXT]/dwr/engine.js and util.js, and also [CONTEXT]/dwr/interface/Arithmetic.js.
The problem is, when I open index.jsp which contains dwr call, the dwr js variable is not defined as well the Arithmetic variable.
The index.jsp itself already decorated from the Sitemesh filter.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com /xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>Struts 2</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value> true </param-value>
</init-param>
<init-param>
<param-name>crossDomainSessionSecurity</param-name>
<param-value>false</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<!-- Filters -->
<filter>
<filter-name>struts-prepare</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareFilter</filter-class>
</filter>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
</filter>
<filter>
<filter-name>struts-execute</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts-prepare</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts-execute</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>jspSupportServlet</servlet-name>
<servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
<load-on-startup>5</load-on-startup>
</servlet>
<listener>
<listener- class>org.apache.struts2.dispatcher.listener.StrutsListener</listener-class>
</listener>
</web-app>
decorators.xml
<?xml version="1.0" encoding="UTF-8"?>
<decorators defaultdir="/decorators">
<excludes>
<pattern>/dwr/*</pattern>
</excludes>
<decorator name="basic-theme" page="basic-theme.jsp">
<pattern>/*</pattern>
</decorator>
</decorators>
dwr.xml
<!DOCTYPE dwr PUBLIC
"-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN"
"http://directwebremoting.org/schema/dwr20.dtd">
<dwr>
<allow>
<create creator="new" javascript="HelloAjaxService">
<param name="class" value="com.test.struts.ajax.HelloAjaxService" />
</create>
</allow>
</dwr>
index.jsp
<%# 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>
<title>Hello World</title>
<script type="text/javascript" src="/strutsSitemesh/dwr/engine.js"></script>
<script type='text/javascript' src='/strutsSitemesh/dwr/util.js'></script>
<script type='text/javascript' src='/strutsSitemesh/dwr/interface /HelloAjaxService.js'></script>
</head>
<body>
<div
style="background-color: #ffeaa7; font-weight: bold; width: 300px;"
id="divResponse">
<s:form action="hello" method="post">
<s:textfield id="name" name="name" label="Name" size="20"
onkeypress="sayHello()" />
<s:textfield name="age" label="Age" size="20" />
<s:submit name="submit" label="Submit" align="center" />
</s:form>
<script type="text/javascript">
function sayHello() {
console.log(dwr.util.getValue("name"));
HelloAjaxService.sayHelloAjax(function(data) {
dwr.util.setValue("divResponse", data);
});
}
</script>
</body>
</html>
If I commented filter-mapping sitemesh ---- the DWR call will work just fine. So I assume, the request will filtered by SitemeshFilter, and strangely it will not go to DWR filter. I tried to search about how to arrange filter in sequence, but nothing comes up. Any help appreciated. Big thanks.
So, I solved it by moving dwr js declaration to the body tag of index.jsp. It happened because in my decorators.jsp, I only put <decorator:body>, and because of that, the <head> tag in decorators.jsp take precedence of the actual .jsp file(In this case, index.jsp).
I created a simple project to login using spring security.
The composition of my project is presented by screenshot:
.
bellow are the required files:
spring-security.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">
<http auto-config="true">
<intercept-url pattern="/welcome.jsf" access="ROLE_USER" />
<form-login login-page="/login.jsf" default-target-url="/welcome.jsf"
authentication-failure-url="/login.jsf?status=error" />
<logout logout-success-url="/login.jsf?status=logout" />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="walid" password="111" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web_1:web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:javaee="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:web="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
http://xmlns.jcp.org/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="Spring-Security-Custom-Login-Form_ID"
version="2.4">
<javaee:display-name>HelloWorld</javaee:display-name>
<javaee:listener>
<javaee:listener-class>org.springframework.web.context.ContextLoaderListener</javaee:listener-class>
</javaee:listener>
<javaee:filter>
<javaee:filter-name>springSecurityFilterChain</javaee:filter-name>
<javaee:filter-class>org.springframework.web.filter.DelegatingFilterProxy</javaee:filter-class>
</javaee:filter>
<javaee:filter-mapping>
<javaee:filter-name>springSecurityFilterChain</javaee:filter-name>
<javaee:url-pattern>/*</javaee:url-pattern>
</javaee:filter-mapping>
<javaee:context-param>
<javaee:param-name>contextConfigLocation</javaee:param-name>
<javaee:param-value>/WEB-INF/spring-security.xml</javaee:param-value>
</javaee:context-param>
<javaee:context-param>
<javaee:description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</javaee:description>
<javaee:param-name>javax.faces.STATE_SAVING_METHOD</javaee:param-name>
<javaee:param-value>client</javaee:param-value>
</javaee:context-param>
<javaee:context-param>
<javaee:param-name>javax.servlet.jsp.jstl.fmt.localizationContext</javaee:param-name>
<javaee:param-value>resources.application</javaee:param-value>
</javaee:context-param>
<javaee:listener>
<javaee:listener-class>com.sun.faces.config.ConfigureListener</javaee:listener-class>
</javaee:listener>
<javaee:servlet>
<javaee:servlet-name>Faces Servlet</javaee:servlet-name>
<javaee:servlet-class>javax.faces.webapp.FacesServlet</javaee:servlet-class>
<javaee:load-on-startup>1</javaee:load-on-startup>
</javaee:servlet>
<javaee:servlet-mapping>
<javaee:servlet-name>Faces Servlet</javaee:servlet-name>
<javaee:url-pattern>/faces/*</javaee:url-pattern>
</javaee:servlet-mapping>
</web_1:web-app>
login.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!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"
xmlns:c="http://java.sun.com/jstl/core">
<body>
<h3>Enter your username and password</h3>
<form method="post" action="j_spring_security_check">
UserName :<input name="j_username" type="text" /> <br />
Password :<input name="j_password" type="password" /> <br />
<input value="Login" type="submit" />
</form>
<br />
<c:if test="${param.status=='error'}">
<label style="color:red">Invalid username or password!!</label>
</c:if>
<c:if test="${param.status=='logout'}">
<label style="color:red">Logged out successfully!</label>
</c:if>
</body>
</html>
welcome.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!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">
<body>
<h2>Welcome Page</h2>
<br />
Logout
</body>
</html>
After login with (walid,111), I got this exception
Could you please help me solving this. Thanks a lot.
your web.xml seems wrong, you can try this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:javaee="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:web="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="Spring-Security-Database-Authentication_ID" version="2.4">
<display-name>Spring-Security-Database-Authentication</display-name>
<servlet>
<servlet-name>JSF Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JSF Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>JSF Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-security.xml</param-value>
</context-param>
</web-app>
HTH
Hello Every body i'm a beginner in j2ee developping .. i developed a jsf application , created some jsf views within , but when i try to execute it on my tomcat 7 server , all i see is a "page web introuvable" message
here is my code:
login.xhtml:
<!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"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<link rel="stylesheet" type="text/css" href="../css/styles.css"/>
<title>Authentification</title>
</h:head>
<h:body>
<h:form>
<h:panelGrid columns="2">
<h:outputLabel value="Login:" />
<h:inputText value="#{loginBean.login}" size="30"/>
<h:outputLabel value="Mot de passe:" />
<h:inputSecret id="pwdId" value="#{loginBean.password}" size="30" />
<h:commandButton value="Valider" type="submit" action="#{loginBean.authentification}" />
<h:commandButton type="reset" value="Reset" />
</h:panelGrid>
</h:form>
<h:messages style="COLOR: #ff0000;"/>
</h:body>
</html>
index.jsp:
<%# 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>
<% response.sendRedirect("pages/login.jsf"); %>
</body>
</html>
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>GestionBibliotheque</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
</web-app>
JSP is not supported in JSF 2.
Create index.html with redirect to login page using meta tag:
<meta http-equiv="refresh" content="0; url=./login.jsf" />
Simple example here
I have a problem with my UTF-8 encoding. My webapp uses french words that are correctly displayed in my jsp, but not in my controller after a POST.
For example, in my jsp I have:
Prénom de mon père
and when I post the form, the controller gets:
Prénom de mon père
The characterEncodingFilter is the first filter in the file as described in this post
Here is my jsp:
<%# page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!doctype html>
<%# taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%# taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="content-language" content="fr">
...
</head>
<form:form class="form-horizontal" modelAttribute="AlimentationForm"
action="${actionUrl}" method="POST">
...
<form:input path="questions" class='input-xlarge' type='text' value='Prénom de mon père'/>
</form>
My web.xml:
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/web/*</url-pattern>
</filter-mapping>
And my application-config.xml
<beans:bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<beans:property name="basename">
<beans:value>classpath:messages</beans:value>
</beans:property>
<beans:property name="defaultEncoding" value="UTF-8" />
</beans:bean>
I don't know what's wrong in my app or my configuration, have you got any idea?
Thank in advance.
EDIT: I'm using HDIV framework
This problem actually came from HDIV framework version 2.1.2. A patch is available here if you can't use the next release.
Hope it will help someone.
Make sure the JSP page encodes the data sent to the server properly. Try adding
<%#page pageEncoding="UTF-8" %>
to the top of your JSP as this ensures any data sent along http will get encoding correctly.
I believe the default http encoding is ISO-8859-1.
It shows http 500 with jasper error, while launching the application, Im using jersey and struts2 in same project. Any particular configuration is required. Eventhough, all jar files are included, it shows error.
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>RestExample</display-name>
<welcome-file-list>
<welcome-file>/jsp/login.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>jersey-serlvet</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.src.matchmaker.services</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jersey-serlvet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
</web-app>
struts.xml
<!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.action.excludePattern" value="/rest/.*" />
<!-- Configuration for the default package. -->
<package name="default" extends="struts-default">
</package>
</struts>
login.jsp
<%--
Document : register
Created on : Jan 31, 2013, 11:18:43 AM
Author : wifin
![enter image description here][1]--%>
<%#page language="java" contentType="text/html" pageEncoding="UTF-8"%>
<%# taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/match_login_style.css" type="text/css">
<link rel="icon" type="image/jpg" href="<%=request.getContextPath()%>/images/logo.jpg"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.validation.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/login_validation.js"></script>
</head>
<body>
<div class="wrap">
<div class="back" align="center">
<form id="login" name="login" action="login.action" method="post">
<div align="center" class="header">Login</div>
<div id="err"><s:actionerror/></div>
<div class="tit">
Email Id: <input type="text" name="emailId" id="emailId"/>
<div class="clr"></div>
</div>
<div class="tit">
Password: <input type="password" name="password" id="password"/>
<div class="clr"></div>
</div>
<div>
<input class="btn" type="submit" name="reg" value="Login" id="reg" />
<input class="btn" type="reset" value="Cancel" id="cancel" />
</div>
</form>
<div><a class="link" href="<%=request.getContextPath()%>/jsp/register.jsp">New User?</a></div>
</div>
</div>
</body>
</html>
You page is being displayed without going through Struts2 filter. You need to call Struts2 action which will display your page as a result.
Also the org.apache.struts2.dispatcher.FilterDispatcher is deprecated since Struts 2.1.3, so if you are using version greater then 2.1.3 change FilterDispatcher to org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.
Also why not to intercept all url patterns with this filter? Change this filter <url-pattern> to <url-pattern>/*</url-pattern>.
BTW using scriptlets in JSP is a bad practice, use Struts2 tags instead.