哎,你加入一java脚本就成了,如:
<%
if(style==1){
%><template:insert template="/test/template1.jsp">
<%
}else{
%>
<template:insert template="/test/template2.jsp"><%
}
%>应该就可以了,你也可以这样写:
<%
if(style==1){
%><template:insert template="/test/template1.jsp">
<template:put name="header" content="header.html"/>
<template:put name="content" content="employeeList.jsp?id=${param.id}"/>
<template:put name="footer" content="footer.html"/>
<template:put name="test" direct="true" content="test print str"/>
</template:insert><%
}else{
%>
<template:insert template="/test/template2.jsp">
<template:put name="header" content="header.html"/>
<template:put name="content" content="employeeList.jsp?id=${param.id}"/>
<template:put name="footer" content="footer.html"/>
<template:put name="test" direct="true" content="test print str"/>
</template:insert>
<%
}
%>有时Struts没有办法解决所有问题(当然这里也可以用它的logic标签,意思是一样的),就得加入部分java脚本!
<%
if(style==1){
%><template:insert template="/test/template1.jsp">
<%
}else{
%>
<template:insert template="/test/template2.jsp"><%
}
%>应该就可以了,你也可以这样写:
<%
if(style==1){
%><template:insert template="/test/template1.jsp">
<template:put name="header" content="header.html"/>
<template:put name="content" content="employeeList.jsp?id=${param.id}"/>
<template:put name="footer" content="footer.html"/>
<template:put name="test" direct="true" content="test print str"/>
</template:insert><%
}else{
%>
<template:insert template="/test/template2.jsp">
<template:put name="header" content="header.html"/>
<template:put name="content" content="employeeList.jsp?id=${param.id}"/>
<template:put name="footer" content="footer.html"/>
<template:put name="test" direct="true" content="test print str"/>
</template:insert>
<%
}
%>有时Struts没有办法解决所有问题(当然这里也可以用它的logic标签,意思是一样的),就得加入部分java脚本!
解决方案 »
- dynamic web project 发布问题
- 用hibernate 加spring 插入不了数据
- 关于Struts
- JSP生成HTML静态页面
- 求JDK1.5下载地址,能传给我也行
- 有jdk1.4帮助文档的大哥,给我传一个!邮箱是[email protected]
- 哪里可以下到J2EE?SUN的速度太慢了!
- 使用struts2的防止重复提交遇到一个小麻烦!
- Struts2重定向后页面不跳转,求大神解决!
- spring mvc 访问静态资源疑问
- c = getDataSource().getConnection();是什么意思啊?
- 麻烦大侠给个EJB完整的配置例子,不胜感激,小弟我网上找的都是半调子,急也急死了,希望对配置文件有个说明,100分送!!!
我的思路是美工可以任意在模版目录下添加模版.系统自动读取模版文件列表供选择,选择了哪个模版,由此信息内容采用这个模版如果采用if(...)(<template:insert template="/test/template2.jsp">)的方法,美工每新做一个模版,我都要重新改一下jsp文件不知道有没有法子改变template=这里的值呢?
test.jsp?id=* 只传递了一个信息ID值,
所的我在<template:put name="content" content="employeeList.jsp?id=${param.id}"/>
用el语句得到ID.将ID传入employeeList.jsp开始我想这样,test.jsp?id=*&style=*
然后test.jsp中<template:insert template="/test/template${param.style}.jsp">
但这样浏览者可以改变样式的值
因为test.jsp并没有操作数据库.style的值是从action中传入的
但struts不能嵌套标签
比如<template:insert template="/test/template<bean:write name="style" scope="request">.jsp">是会出错的现在的问题不知道怎么样action的style的值怎么传到<template:insert template="/test/template这里来.jsp">
闲那种方式实现的不好 ?
the JSP spec at `/templates/test/template<%=style%>.jsp'
我的短消息不知道为什么不能回复关于过滤器的问题 应该可以过滤目录的啊 有没有具体的api我不清楚 不过自己写算法 去比较字串 来判断url里面有没有特定目录应该行的通