之前为在html上显示文章内容,写了一个宏
<#--文章内容-->
<#macro ArtiContent>
<#include arti.relPath(pageNo) parse=false/>
</#macro>
arti.relPath()返回一个类似于/WEB-INF/content/a.txt这样的文章路径现在文章文件不想放到WEB-INF目录中,但是include只认WEB-INF路径下的东西
这里应该用什么标签可以读取其他位置的文件,例如arti.relPaht()返回路径为f:/content/a.txt大家帮帮忙~~~~~~~~~~~~
<#--文章内容-->
<#macro ArtiContent>
<#include arti.relPath(pageNo) parse=false/>
</#macro>
arti.relPath()返回一个类似于/WEB-INF/content/a.txt这样的文章路径现在文章文件不想放到WEB-INF目录中,但是include只认WEB-INF路径下的东西
这里应该用什么标签可以读取其他位置的文件,例如arti.relPaht()返回路径为f:/content/a.txt大家帮帮忙~~~~~~~~~~~~
解决方案 »
- String.matches(String regex)的问题
- HTTP Status 500问题!!!急求!!!
- 关于session
- 熟悉richfaces的大哥请来帮个忙
- 救命啊 Tomcat启动问题
- ==========谁知道怎么修改java文件里的语句,使它成为servlet文件?======谢谢!
- 如何在jsp中生成只在本session中有效的文件??????
- 请教:servlet中处理完一个页面的后怎样返回(跳转)到另外的一个页面?
- 在线等待:简单的if语句出错。
- SpringMVC +Mybatis 一个问题 Invalid bound statement (not found):
- 关于SQLserver连接的问题
- Servlet 中使用 el 值出不来?;[初学者求助~]
路径的变量是templatePath,通过getInitParameter("TemplatePath");取得的。
也就是说可以通过web.xml定义。我的一个项目的代码片段贴给你:
web.xml <servlet>
<servlet-name>freeer</servlet-name>
<servlet-class>xxx.xxx.xxx.EnhancedFreeerServlet</servlet-class> <!--
Please see following URL about the configuration of the FreeerServlet settings.
http://freeer.org/docs/pgui_misc_servlet.html
-->
<init-param>
<param-name>TemplatePath</param-name>
<param-value>/WEB-INF/ftls</param-value>
<!--
When storing it outside the context.(C:\ftls or /ftls direcroty)
<param-value>file:///var/cws_contents/ftls/xxxx</param-value>
-->
</init-param>
<init-param>
<param-name>NoCache</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>ContentType</param-name>
<param-value>text/html; charset=UTF-8</param-value>
<!--
It is not possible to use it because it is not supported with IE6
and FireFox3 though the following setting is recommended in W3C.
<param-value>application/xhtml+xml; charset=UTF-8</param-value>
-->
</init-param> <!--
Please see following URL about the configuration of the FreeMarker settings.
http://freeer.org/docs/pgui_config_settings.html
http://freeer.org/docs/api/freeer/core/Configurable.html#setSetting(java.lang.String,%20java.lang.String)
http://freeer.org/docs/api/freeer/template/Configuration.html#setSetting(java.lang.String,%20java.lang.String)
-->
<load-on-startup>1</load-on-startup>
</servlet>
上面EnhancedFreeerServlet是我们封装的FreeerServlet,和客户有版权协议,EnhancedFreeerServlet不能贴给你。但是路径什么的,都是FreeerServlet里面的,应足够LZ用了。
还是我应该再换一个标签?还是应该怎么写呢?
不好意思,俺只负责写底层,ftl的宏俺看了就头晕,所以全推给新人做了,俺不懂。