当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Including JSTL taglib in Apache Tiles template

问题描述:

I am using Apache Tiles, in my small Spring MVC project, and I use JSTL tags to display data in my application views. But whenever I load any page (view) I can't see any data displayed, moreover I don't see the include tag line in top of the page, so can someone please check my configuration and code files below and tell me what I am missing? Note: I don't get any error...simply nothing is displayed as if the JSTL tag is never included.

  1. Tiles.xml

<tiles-definitions>

<definition name="mainLayout" template="/WEB-INF/views/layout.jsp">

<put-attribute name="title" value="Test Company" />

<put-attribute name="header" value="/WEB-INF/views/header.jsp" />

<put-attribute name="navigation" value="" />

<put-attribute name="body" value="" />

<put-attribute name="footer" value="/WEB-INF/views/footer.jsp" />

</definition>

<definition name="mainPage" extends="mainLayout"">

<put-attribute name="title" value="Home" />

<put-attribute name="header" value="" />

<put-attribute name="navigation" value="" />

<put-attribute name="body" value="/WEB-INF/views/home.jsp" />

<put-attribute name="footer" value="" />

</definition>

</tiles-definitions>

  1. Layout.jsp

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>

<%@ page session="false" %>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>

/resources/css/style.css">

/resources/jq/jquery-1.10.2.min.js">


 <div id="sidebar">

<tiles:insertAttribute name="navigation" />

</div>

<div class="clear"></div>

</div>

<tiles:insertAttribute name="footer" />

  1. home.jsp

    <div id="main">

    <div class="section">

    <c:forEach var="country" items="${countriesList}">

    <div class="table_row">

    <div class="cell important">${country.id}</div>

    <div class="cell">${country.countryName}</div>

    </div>

    </c:forEach>

    </div>

    </div>

  2. CountryController.java

    @RequestMapping(value = "admin/countries")

    public String listCountries(HttpServletRequest request,Locale locale, Model model){

    model.addAttribute("countriesList", icountryservice.getAllCountries());

    return "mainPage";

    }

Can someone please tell me what I am missing here, and how I can get JSTL tags to work again?

Thanks for your time

NOTE: I tried to paste the content of layout.jsp but I can't paste it here as code or anything...any idea how to paste html code here?

分享给朋友:
您可能感兴趣的文章:
随机阅读: