You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Srineel Mazumdar <sm...@gmail.com> on 2013/10/05 17:04:55 UTC
Issues with Struts Tiles
Hi,
I am getting the following issues with Tiles + Struts 2 : Please help
***************************************************************************************
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at
org.apache.struts.taglib.tiles.InsertTag.processAttribute(InsertTag.java:687)
at
org.apache.struts.taglib.tiles.InsertTag.createTagHandler(InsertTag.java:478)
at org.apache.struts.taglib.tiles.InsertTag.doStartTag(InsertTag.java:438)
Struts has detected an unhandled exception:
*Messages*:
1. ServletException including path '/WEB-INF/jsp/homepage.jsp'.
2. ServletException including path '/WEB-INF/jsp/homepage.jsp'.
*File*: org/apache/struts/taglib/tiles/InsertTag.java *Line number*: 687
------------------------------
Stacktraces
*org.apache.tiles.TilesException: ServletException including path
'/WEB-INF/jsp/homepage.jsp'.*
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:614)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:246)
***********************************************************************
*petStoreTilesConfigFile.xml*
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="homePage" template="/WEB-INF/jsp/homepage.jsp">
<put-attribute name="header" value="/WEB-INF/jsp/IncludeTop.jsp" />
<put-attribute name="menu" value="/WEB-INF/jsp/menu.jsp" />
<put-attribute name="body" value="/WEB-INF/jsp/index.jsp" />
<put-attribute name="banner" value="/WEB-INF/jsp/IncludeBanner.jsp" />
<put-attribute name="footer" value="/WEB-INF/jsp/IncludeBottom.jsp" />
</definition>
</tiles-definitions>
*********************************************************************
*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_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>NewPetstore</display-name>
<!-- - Key of the system property that should specify the root directory
of this - web app. Applied by WebAppRootListener or Log4jConfigListener. -->
<context-param>
<param-name>org.apache.tiles.CONTAINER_FACTORY</param-name>
<param-value>org.apache.struts2.tiles.StrutsTilesContainerFactory</param-value>
<param-name>org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/petStoreTilesConfigFile.xml</param-value>
</context-param>
<!-- - Key of the system property that should specify the root directory
of this - web app. Applied by WebAppRootListener or Log4jConfigListener. -->
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>petstore.root</param-value>
</context-param>
<!-- - Location of the Log4J config file, for initialization and refresh
checks. - Applied by Log4jConfigListener. -->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dataAccessContext-local.xml
/WEB-INF/applicationContext.xml</param-value>
<!-- <param-value>/WEB-INF/dataAccessContext-jta.xml
/WEB-INF/applicationContext.xml</param-value> -->
</context-param>
<context-param>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/petStoreTilesConfigFile.xml</param-value>
</context-param>
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<listener>
<!-- <listener-class>org.apache.tiles.web.startup.TilesListener</listener-class>
-->
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
<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>
</web-app>
*
*********************************************************************
*homepage.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">
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Home Page : Pet Store</title>
</head>
<body>
<tiles:insert attribute="header" />
<tiles:insert attribute="menu" />
<tiles:insert attribute="body" />
<tiles:insert attribute="banner" />
<tiles:insert attribute="footer" />
</body>
</html>*
*Regards,*
*Srineel*
Re: Issues with Struts Tiles
Posted by Per Pascal Grube <cy...@flightmare.net>.
One thing, that I saw while looking at your code is that I have a different
taglib:
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
and that I use
<tiles:insertAttribute name="body" />
to include fragments.
Maybe this helps.
Regards, Pascal
On Saturday 05 October 2013 11:04:55 Srineel Mazumdar wrote:
> Hi,
>
> I am getting the following issues with Tiles + Struts 2 : Please help
>
> ****************************************************************************
> *********** SEVERE: Servlet.service() for servlet jsp threw exception
> java.lang.NullPointerException
> at
> org.apache.struts.taglib.tiles.InsertTag.processAttribute(InsertTag.java:687
> ) at
> org.apache.struts.taglib.tiles.InsertTag.createTagHandler(InsertTag.java:478
> ) at org.apache.struts.taglib.tiles.InsertTag.doStartTag(InsertTag.java:438)
>
> Struts has detected an unhandled exception:
> *Messages*:
>
> 1. ServletException including path '/WEB-INF/jsp/homepage.jsp'.
> 2. ServletException including path '/WEB-INF/jsp/homepage.jsp'.
>
> *File*: org/apache/struts/taglib/tiles/InsertTag.java *Line number*: 687
> ------------------------------
> Stacktraces
> *org.apache.tiles.TilesException: ServletException including path
> '/WEB-INF/jsp/homepage.jsp'.*
>
>
> org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:6
> 14)
> org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:2
> 46)
>
> ***********************************************************************
>
> *petStoreTilesConfigFile.xml*
>
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <!DOCTYPE tiles-definitions PUBLIC
> "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
> "http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
> <tiles-definitions>
> <definition name="homePage" template="/WEB-INF/jsp/homepage.jsp">
> <put-attribute name="header" value="/WEB-INF/jsp/IncludeTop.jsp" />
> <put-attribute name="menu" value="/WEB-INF/jsp/menu.jsp" />
> <put-attribute name="body" value="/WEB-INF/jsp/index.jsp" />
> <put-attribute name="banner" value="/WEB-INF/jsp/IncludeBanner.jsp" />
> <put-attribute name="footer" value="/WEB-INF/jsp/IncludeBottom.jsp" />
> </definition>
> </tiles-definitions>
>
> *********************************************************************
>
> *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_2_5.xsd"
> id="WebApp_ID" version="2.5">
> <display-name>NewPetstore</display-name>
> <!-- - Key of the system property that should specify the root directory
> of this - web app. Applied by WebAppRootListener or
Log4jConfigListener.
> --> <context-param>
> <param-name>org.apache.tiles.CONTAINER_FACTORY</param-name>
> <param-
value>org.apache.struts2.tiles.StrutsTilesContainerFactory</param-v
> alue>
> <param-name>org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONF
> IG</param-name>
> <param-value>/WEB-INF/petStoreTilesConfigFile.xml</param-value>
> </context-param>
>
> <!-- - Key of the system property that should specify the root directory
> of this - web app. Applied by WebAppRootListener or
Log4jConfigListener.
> --> <context-param>
> <param-name>webAppRootKey</param-name>
> <param-value>petstore.root</param-value>
> </context-param>
>
> <!-- - Location of the Log4J config file, for initialization and refresh
> checks. - Applied by Log4jConfigListener. -->
> <context-param>
> <param-name>log4jConfigLocation</param-name>
> <param-value>/WEB-INF/log4j.properties</param-value>
> </context-param>
>
> <context-param>
> <param-name>contextConfigLocation</param-name>
> <param-value>/WEB-INF/dataAccessContext-local.xml
> /WEB-INF/applicationContext.xml</param-value>
> <!-- <param-value>/WEB-INF/dataAccessContext-jta.xml
> /WEB-INF/applicationContext.xml</param-value> -->
> </context-param>
>
> <context-param>
> <param-
name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</
> param-name> <param-value>/WEB-INF/petStoreTilesConfigFile.xml</param-value>
> </context-param>
> <filter>
> <filter-name>struts</filter-name>
> <filter-
class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExec
> uteFilter</filter-class> </filter>
>
> <filter-mapping>
> <filter-name>struts</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
>
>
>
> <listener>
> <listener-
class>org.springframework.web.context.ContextLoaderListener</lis
> tener-class> </listener>
>
>
> <listener>
> <listener-
class>org.springframework.web.context.request.RequestContextList
> ener</listener-class> </listener>
>
> <listener>
> <!--
> <listener-class>org.apache.tiles.web.startup.TilesListener</listener-class>
> -->
> <listener-
class>org.apache.struts2.tiles.StrutsTilesListener</listener-cla
> ss> </listener>
>
> <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>
> </web-app>
> *
>
> *********************************************************************
>
> *homepage.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">
> <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
>
>
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> <title>Home Page : Pet Store</title>
> </head>
>
> <body>
> <tiles:insert attribute="header" />
> <tiles:insert attribute="menu" />
> <tiles:insert attribute="body" />
> <tiles:insert attribute="banner" />
> <tiles:insert attribute="footer" />
> </body>
> </html>*
>
> *Regards,*
> *Srineel*
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: config-browser plugin and validateAnnotatedMethodOnly
Posted by Lukasz Lenart <lu...@apache.org>.
2013/10/7 Alireza Fattahi <af...@yahoo.com>:
> Hi,
>
> There seems to be a bug in the config-browser plugin, Action Information, validator tab.
>
> When I configure the validation as validateAnnotatedMethodOnly, the validator tab still shows all the validations instead of method specific validations.
>
> I used @Validations for validating methods and @Action for defining actions.
>
> Please let me know if anyone has seen this issue before.
I'm not sure if that issue can be simply solved and
"validateAnnotatedMethodOnly" is a bit a hack - you can always use
@SkipValidation which has more sense or exclude given methods in
interceptor configuration:
<interceptor-ref name="validation">
<param
name="excludeMethods">input,back,cancel,browse</param>
</interceptor-ref>
Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
config-browser plugin and validateAnnotatedMethodOnly
Posted by Alireza Fattahi <af...@yahoo.com>.
Hi,
There seems to be a bug in the config-browser plugin, Action Information, validator tab.
When I configure the validation as validateAnnotatedMethodOnly, the validator tab still shows all the validations instead of method specific validations.
I used @Validations for validating methods and @Action for defining actions.
Please let me know if anyone has seen this issue before.
~Regards,
~~Alireza Fattahi