aspose file tools*
The moose likes Spring and the fly likes Error Spring + tiles 2.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Error Spring + tiles 2.2" Watch "Error Spring + tiles 2.2" New topic
Author

Error Spring + tiles 2.2

Alvaro Ferreres
Greenhorn

Joined: Jan 27, 2012
Posts: 1
Hello everyone:

I'm trying to make a easy program in spring which is not been as easy as I thought. I'm trying a simple "Hello world" in spring using tiles 2.2. This is my code:

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>Archetype Created Web Application</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<servlet>
<servlet-name>ejercicio15</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>ejercicio15</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>

ejercicio15-servlet.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<context:component-scan base-package="com.spring.ejercicio15.web"/>
<mvc:annotation-driven/>
<mvc:resources location="/resources/" mapping="/resources/**"/>

<bean class="org.springframework.js.ajax.AjaxUrlBasedViewResolver" id="tilesViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>
</bean>
<bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer" id="tilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/views/**/views.xml</value>
</list>
</property>
</bean>

</beans>

com.spring.ejercicio15.web.Ejer15Controller.java

package com.spring.ejercicio15.web;

import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class Ejer15Controller {

@RequestMapping (value="/step")
public String step1 (Map<String, Object> model){
return "step1";
}
}


base.jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-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=ISO-8859-1">
<title>Ejercicio 15</title>
</head>
<body>
<tiles:insertAttribute name="body"/>
</body>
</html>

views.xml of base.jsp:
<?xml version="1.0" encoding="UTF-8"?>
<!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="base" template="/WEB-INF/views/plantillas/base.jsp">
</definition>
</tiles-definitions>

step1.jsp
<h1>This is the exercise 15 </h1>
<p>Thank you</p>

view.xml of step1.jsp
<?xml version="1.0" encoding="UTF-8"?>
<!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="step1" extends="base">
<put-attribute name="body" value="/WEB-INF/views/ejercicio15/step1.jsp"/>
</definition>
</tiles-definitions>

When I access to the url "/step" I get this error message:
27-ene-2012 9:17:19 org.apache.catalina.core.StandardWrapperValve invoke
CRITICAL: Servlet.service() for servlet ejercicio15 throws exception
org.apache.jasper.JasperException: /WEB-INF/views/plantillas/base.jsp(2,67) can't read TLD "META-INF/tld/tiles-jsp.tld" from jar file "file:/C:/Users/aferrere/Master/Ejercicios/Tema%202/Ejercicio%2015%20-%20Spring%20MVC%20avanzado/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/ejercicio15/WEB-INF/lib/tiles-jsp-2.2.0.jar": org.apache.jasper.JasperException: can't load the class TagExtraInfo: org.apache.tiles.jsp.taglib.UseAttributeTag$Tei (I translated my logg error from spanish... Sorry if the message is not clear at all)

Does someone know where my mistake could be?

Thank you everyone in advance for you attention
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error Spring + tiles 2.2