首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >更改web应用程序的url后,不再识别Layout.css

更改web应用程序的url后,不再识别Layout.css
EN

Stack Overflow用户
提问于 2013-08-08 08:08:52
回答 1查看 245关注 0票数 0

您好,我正在使用Tapestry5创建一个规划web应用程序,并且为了避免spring安全问题,我已经将org.apache.tapestry5.TapestryFilter中的url模式从/*更改为/ planning /*,相应地更改了任何Java / .tml文件中相应的url和文件路径,web应用程序可以按原样运行,但是我的css样式表不再被使用。

我在组件文件中有一个Layout.java和相应的Layout.tml,然后在webapp文件的布局文件夹中有一个layout.css文件(在WEB-INF之外)

样式表是由@Import(stylesheet="context:layout/layout.css")在Layout.java文件中调用的-这在以前总是有效的!

我已经尝试将css文件移动到planning子目录planning/layout/layout.css中,但这似乎仍然没有什么不同!

Web.xml

代码语言:javascript
运行
AI代码解释
复制
  <display-name>Planning Tapestry 5 Application</display-name>

  <context-param>
    <param-name>tapestry.app-package</param-name>
    <param-value>com.quartetfs.planning.tapestry</param-value>
  </context-param>

  <filter>
    <filter-name>app</filter-name>
    <filter-class>org.apache.tapestry5.TapestryFilter</filter-class>
  </filter>

  <filter-mapping>
    <filter-name>app</filter-name>
    <url-pattern>/planning/*</url-pattern>
  </filter-mapping>

Layout.java

代码语言:javascript
运行
AI代码解释
复制
import org.apache.tapestry5.*;
import org.apache.tapestry5.annotations.*;
import org.apache.tapestry5.ioc.annotations.*;
import org.apache.tapestry5.BindingConstants;

/**
 * Layout component for pages of Planning Application.
 */
@Import(stylesheet="context:layout/layout.css")
public class Layout
{
    /** The page title, for the <title> element and the <h1> element. */
    @Property
    @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
    private String title;

    @Property
    private String pageName;

    @Property
    @Parameter(defaultPrefix = BindingConstants.LITERAL)
    private String sidebarTitle;

    @Property
    @Parameter(defaultPrefix = BindingConstants.LITERAL)
    private Block sidebar;

    @Inject
    private ComponentResources resources;

    public String getClassForPageName()
    {
      return resources.getPageName().equalsIgnoreCase(pageName)
         ? "current_page_item"
         : null;
    }

    public String[] getPageNames()
    {
      return new String[] { "planning/Index", };// "About", "Contact" }; TODO
    }
}

Layout.tml

代码语言:javascript
运行
AI代码解释
复制
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-     strict.dtd">
<!--

Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Title      : Concrete
Version    : 1.0
Released   : 20080825
Description: A Web 2.0 design with fluid width suitable for blogs and small websites.
-->

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
      xmlns:p="tapestry:parameter">



    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>${title}</title>
    </head>

    <body>
        <!-- start header -->
        <div id="header">
            <div id="logo">
                <h1>
                    <t:pagelink page="planning/index">Project and Resource Planning</t:pagelink>
                </h1>
            </div>
            <div id="menu">
                <ul>
                   <li t:type="loop" source="pageNames" value="pageName" class="prop:classForPageName">
                        <t:pagelink page="prop:pageName">${pageName}</t:pagelink>
                    </li>
                </ul>
             </div>
        </div>
        <!-- end header -->

        <!-- start page -->
        <div id="page">
            <!-- start sidebar -->
            <div id="sidebar">
                <ul>
                    <li id="search" style="background: none;">
                    </li>
                    <li t:type="if" test="sidebar">
                        <h2>${sidebarTitle}</h2>
                        <div class="sidebar-content">
                            <t:delegate to="sidebar"/>
                        </div>
                    </li>
                </ul>
            </div>
            <!-- end sidebar -->

            <!-- start content -->
            <div id="content">
                <div class="post">
                    <div class="title">
                        <h2>${title}</h2>
                    </div>
                    <div class="entry">
                        <t:body/>
                    </div>
                </div>
            </div>
            <!-- end content --> 

            <br style="clear: both;"/>
        </div>
        <!-- end page -->

        <!-- start footer -->
        <div id="footer">
            <p class="legal">
                &copy;2009 com.example. All Rights Reserved.
                &nbsp;&nbsp;&bull;&nbsp;&nbsp;
                Design by
                <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>
                &nbsp;&nbsp;&bull;&nbsp;&nbsp;
                Icons by
                <a href="http://famfamfam.com/">FAMFAMFAM</a>.
            </p>
        </div>
        <!-- end footer -->

    </body>
</html>
EN

回答 1

Stack Overflow用户

发布于 2013-08-08 17:55:16

您应该不必移动layout.css文件;如果Tapestry找不到它,那么在加载包含布局组件的页面时,它将抛出异常。

当您遇到这样的问题时,查看呈现页面的源代码并查看请求和响应是非常有用的。

我怀疑样式表的URL是"/assets/ ...“...它不会被Tapestry拾取(由于过滤器映射是如何设置的),您将看到一个404错误。

有必要通知Tapestry您已经将应用程序放在一个子文件夹中(遗憾的是,Servlet API不提供对如何在web.xml中配置内容的自省)。

http://tapestry.apache.org/configuration.html#Configuration-tapestry.applicationfolder

一旦Tapestry知道了应用程序文件夹,它就可以构建正确的URL。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18121002

复制
相关文章
WPF 将 docx 的 Word 文件转换为 FlowDocument 显示
在 Office 文档解析 文档格式和协议 咱可以了解到 Word 文档只是一个压缩文件里面的文件使用 xml 表示
林德熙
2020/08/07
1.6K0
Word 神器 python-docx
前两天有个朋友向我求助,她在写毕业论文时,不小心将论文里的中文双引号替换为英文的了,各种原因导致无法回退,8万多字的论文,眼看就要交了,该怎么办?
纯洁的微笑
2020/04/01
2.9K0
Word 神器 python-docx
用golang在服务端将html转为word(docx)尝试
我用goquery+github.com/unidoc/unioffice来尝试一下。
hotqin888
2019/12/20
8.3K0
用golang在服务端将html转为word(docx)尝试
python-docx操作word文件(
document.add_paragraph()之后,默认paragraph的内容到第一个run中。
py3study
2020/01/17
1.5K0
python_docx制作word文档
Python可以利用python-docx模块处理word文档,处理方式是面向对象的。也就是说python-docx模块会把word文档,文档中的段落、文本、字体等都看做对象,对对象进行处理就是对word文档的内容处理。
py3study
2020/01/15
3.1K0
python_docx制作word文档
Python-Word模板填充-docx
docxtpl 按指定的word模板填充内容 安装 pip install docxtpl 示例 from docxtpl import DocxTemplate data_dic = { 't1':'燕子', 't2':'杨柳', 't3':'桃花', 't4':'针尖', 't5':'头涔涔', 't6':'泪潸潸', 't7':'茫茫然', 't8':'伶伶俐俐', } doc = DocxTemplate('tpl.docx') #加载模板文件 doc.render(data_dic) #
py3study
2020/01/16
2.8K0
Python-Word模板填充-docx
Python 向word(docx)中输
如果python2安装后不能使用(找不到包),建议直接使用python3,安装代码如下
py3study
2020/01/06
5090
SharePoint下利用DocX组件导出Word
平常开发时,或多或少都需要和Word打交道,特变是编辑、导出Word。 利用DocX,开源的读写Word组件,可以快速帮助我们进行对Word的操作。 DocX官方网站:http://docx.codeplex.com/ DocX主要功能 在文档中(Word)插入,删除或者替换文本,支持所有的标准文本格式,如字体{Family,Size,Color},出体,斜体、下划线、高亮等。 提供段落属性,你可以设置其对其方向,如从左到右,居中对齐等。 DocX同样支持对图片的操作、超链接、表格、页首、页眉等。 最
用户1161731
2018/01/11
1.5K0
SharePoint下利用DocX组件导出Word
HTML转word_怎么把docx转换成word
使用 html-docx.js、FileSaver.js 、wordexport文件
全栈程序员站长
2022/11/04
4.2K0
HTML转word_怎么把docx转换成word
HDFS——如何将文件从HDFS复制到本地
复制文件到本地文件系统。可用-ignorecrc选项复制CRC校验失败的文件。使用-crc选项复制文件以及CRC信息。
星哥玩云
2022/06/30
7K0
word批量doc转docx格式-python
今天想要实现一个功能是将word内容转换成HTML,查看了网上的代码,还是比较简单的,python中的PyDocX类库可以实现功能。但是存在一个问题,就是word2003版本文档后缀是.doc,在后期版本中后缀是.docx。PyDocX只能处理后缀为.docx格式的文档文件。那么就需要将其进行转换。
申霖
2020/03/24
2.2K0
python读取word详解【from docx import Document】
python读取word详解【from docx import Document】
红目香薰
2022/11/30
1.9K0
python读取word详解【from docx import Document】
使用python-docx模块读写word文件
word文档的自动化处理是一件比较头痛的事情,因为深耕于windows操作系统,对于跨平台需求的word文档编辑,是非常痛苦的一件事。在python的生态环境中,提供了python-docx这个模块,可以方便的进行跨平台的word文档处理,但是只适合word 2007以后的文档,即后缀为docx的文档。
生信修炼手册
2020/12/11
1.6K0
Python将md批量转为docx
这两天写毕业论文, 发现了一个可以将markdown快速转为word格式的小工具pandoc, 非常好用, 比如我有一个名为毕业论文.md的文件, 我只需在命令行运行 pandoc 毕业论文.md
zhaoolee
2018/06/14
1.3K0
【c#搬砖记】用Docx导出word格式的docx文件
DocX开源网址:http://docx.codeplex.com/ 1、引入DocX.dll 调用ReplaceText()方法替换模板中的字符。只支持docx格式的word文档 using (DocX docx = DocX.Load(fileDemo)) { docx.ReplaceText("@某某某", tester.name); docx.ReplaceText("@110101198101010001",
阿炬
2018/05/11
1.6K0
初探JavaScript PDF blob转换为Word docx方法
PDF 转Word 是一个非常非常普遍的需求,可谓人人忌危,为什么如此普遍的需求,却如此难行呢,还得看为什么会有这样的一个需求:
葡萄城控件
2021/10/21
3.1K0
Python提取docx格式Word文档中所有尾注
1、用Word或WPS打开一个docx格式的文档,在文档中单击要插入尾注的位置,然后依次单击菜单,如下图所示。
Python小屋屋主
2020/07/16
9110
Python提取docx格式Word文档中所有尾注
CKEditor使用
https://ckeditor.com/ckeditor-4/download/
码客说
2022/09/19
2.5K0
CKEditor使用
python网络爬虫文档读取-微软Word文档和.docx
大约在2008年以前,微软Office产品中的Word用.doc文件格式。这种二进制格式很难读取,而且能够读取word格式软件很少。为了跟上时代,让自己的软件能够符合主流软件的标准,微软决定使用Open Office的类XML格式标准,此后新版Word文件才与其他文字处理软件兼容,这个格式就是.docx。
用户7886150
2021/01/15
1.4K0
点击加载更多

相似问题

理解枕叶卷积

14

列表理解卷积

30

如何理解卷积模型

11

理解Caffe卷积层

10

理解卷积层的形状

24
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档