Struts OR Tiles OR ??? ...... JSP模板解决方案 [英] Struts OR Tiles OR ???...... JSP template solution

查看:54
本文介绍了Struts OR Tiles OR ??? ...... JSP模板解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我正在使用使用此示例的lib ("/WEB-INF/tlds/template.tld").

currently I'm using a JSP templating system which uses this example's lib ("/WEB-INF/tlds/template.tld").

我什至不知道怎么称呼.

I'm not even sure how it's called.

无论如何,它似乎还不太成熟,它使表单POST方法出现问题,我不知道是谁做的(只是找到了它),而且我听说过Apache的Struts&瓷砖.

Anyway it seems like it's not too developed, it makes problems with form POST method, I have no idea who made it (just found it) and I've heard about Apache's Struts & Tiles.

我什至不确定Struts是否正在执行我在说什么.

I'm not even sure that Struts does what I'm talking about.

正事:
我网站上的页面包含此JSP内容,该内容使用了模板:

Down to business:
A page in my site has this JSP content, that utilizes the template:

<%@ taglib uri="/WEB-INF/tlds/template.tld" prefix="template"%>
<template:insert template="/WEB-INF/main_template_page/template.jsp">
    <template:put name="title" content="Title here" direct="true" />
    <template:put name="content" content="/content.jsp" />
</template:insert>

模板是:

<%@ taglib uri='/WEB-INF/tlds/template.tld' prefix='template'%>
<html>
<head>
<title>
    <template:get name='title' />
</title>
<link type="text/css" rel="stylesheet" href="/styles.css" />
</head>

<body>

    <div id="div_header">
        <div class="content">
            <%@include file='header.html'%>
        </div>
    </div>

    <div id="div_content">
        <template:get name='content' />
    </div>

    <div id="div_footer">
        <%@include file='footer.html'%>
    </div>

</body>
</html>

因此,如您所见,每个页面都为模板提供了一些参数,并且效果很好.

So as you see each page gives the template some parameters and it all works nice.

是否有一个完善的"系统可以做到这一点?我敢肯定有;它叫什么名字?您将使用哪个页面来处理非常简单的页面,但是必须使用代码(JSP)支持动态页面.

Is there a "well-established" system that does that? I'm sure there is; What its name? Which would you use for pretty much simple pages, but, has to support dynamic ones with code (JSP).

推荐答案

四元数是正确的,Tiles和SiteMesh都是非常流行的装饰框架.您还可以使用JSP .tag文件来实现此目的,如

Quaternion is right that Tiles and SiteMesh are both pretty popular decoration frameworks. You can also use JSP .tag files to achieve this, as shown in this answer.

我从未使用过SiteMesh,但是我已经在使用Tiles的多个项目中工作过,我不在乎它-对我来说,这只是一个额外的层,并没有添加足够的爆炸效果,我的钱.标记文件具有作为JSP的内置部分的额外好处.

I've never used SiteMesh, but I've worked on several projects at work that use Tiles and I don't care for it -- to me it's just an extra layer that doesn't add enough bang-for-my-buck. Tag files have the added bonus of being a built-in part of JSP.

这篇关于Struts OR Tiles OR ??? ...... JSP模板解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆