Results 1 to 2 of 2

Thread: Tomcat / Spring MVC / Tiles 2.2.2 InsertAttributeTag Jasper Exception Being Thrown

  1. #1
    Join Date
    Oct 2012
    Posts
    2

    Default Tomcat / Spring MVC / Tiles 2.2.2 InsertAttributeTag Jasper Exception Being Thrown

    In an attempt to migrate a Spring/Tiles 2.2.2 EE Application from was 7 to apache-tomcat-6.0.35 I am seeing exceptions in my presentation layer, pertaining to jasper and the rendering of my tiles.

    Here is an exception...

    Code:
    SEVERE: Servlet.service() for servlet spring-controller threw exception
    org.apache.jasper.JasperException: /WEB-INF/jsp/tilestest/parent.jsp(16,3) The TLD for the class org.apache.tiles.jsp.taglib.InsertAttributeTag specifies an invalid body-content (JSP) for a SimpleTag.
    	at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
    	at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    	at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
    	at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:791)

    In an attempt to better understand the issue, I've simplified an example in my codebase, and I will present the code/wiring here.

    web.xml
    Code:
    	
    <servlet-mapping>
    	<servlet-name>spring-controller</servlet-name>
    	<url-pattern>/tilestest/home</url-pattern>
    </servlet-mapping>
    TilesTestController.java
    Code:
    package com;
    
    import org.springframework.stereotype.Controller;
    import org.springframework.ui.ModelMap;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RequestMethod;
    
    @Controller
    public class TilesTestController {
    	private static final String TILESTEST = "tilestest/home";
    
    	@RequestMapping(value = TILESTEST, method = RequestMethod.GET)
    	public String home(ModelMap model) {
    		return TILESTEST;
    	}
    }
    tilestest.properties
    Code:
    tilestest/home.(class)=org.springframework.web.servlet.view.tiles2.TilesView
    tilestest/home.url=tilestest/home
    layouts.xml
    Code:
    <!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="tilestestParent-layout" template="/WEB-INF/jsp/tilestest/parent.jsp" />
    	
    	<definition name="tilestest/home" extends="tilestestParent-layout">
    		<put-attribute name="title" value="Tiles Test" />
    		<put-attribute name="body" value="/WEB-INF/jsp/tilestest/home.jsp" />
    	</definition>	
    	
    </tiles-definitions>
    parent.jsp
    Code:
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1" %>
    <%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    	<head>
    		<title>
    			<tiles:getAsString name="title" />
    		</title>
    	</head>
    	<body>	
    			Tiles Test Parent...
    			<tiles:insertAttribute name="body" />
    	</body>
    </html>
    home.jsp
    Code:
    tilestest home body here...
    views.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="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-3.1.xsd">
    
    	<bean id="tilesConfigurer"
    		class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
    		<property name="definitions">
    			<list>
    				<value>/WEB-INF/jsp/tilestest/layouts.xml</value>
    			</list>
    		</property>
    		<property name="preparerFactoryClass"
    			value="org.springframework.web.servlet.view.tiles2.SpringBeanPreparerFactory" />
    	</bean>
    	<bean id="resouceBundleViewResolver"
    		class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
    		<property name="basenames">
    			<list>
    				<value>properties/views/tilestest</value>
    			</list>
    		</property>
    	</bean>
    </beans>
    /app is the context root of my app

    If I hit http://localhost:8080/app/tilestest/home I hit my TilesTestController home method successfully, but then fail with the exception above during processing of the <tiles:insertAttribute name="body" /> within parent.jsp

    If I remove <tiles:insertAttribute name="body" /> the parent.jsp renders successfully.

    There seems to be an issue/conflct with Jasper/Tiles/Tomcat? I have tried debugging the doTag() method of InsertAttribute but my breakpoint never gets hit.

    All of this works on was 7.0

    Any thoughts/ideas would be greatly beneficial and very much appreciated.

    Thanks!

  2. #2
    Join Date
    Oct 2012
    Posts
    2

    Default

    This thread can be closed.

    I've found that in our existing application there were Tiles TLD overrides, several actually, one of which is an override for the insertAttribute tag. This tag override contains a <body-content>JSP</body-content> which according to the JSP spec, is not even valid.

    Jasper must be failing whereas WAS must not care. I removed the override and everything works as expected.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •