GlassFish v3上的jspx脚本元素 [英] jspx script element on GlassFish v3

查看:132
本文介绍了GlassFish v3上的jspx脚本元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.war由GlassFish v3提供。我想从我的jspx中包含一个JavaScript文件。

 < script type =text / javascriptsrc =/ base / interface / Service.js>< /脚本> 

我在http响应中获得以下内容:

 < script src =/ base / interface / Service.jstype =text / javascript/> 

问题在于它应该包含< / script> 标签。我相信这就是为什么它可以在Chrome上运行,但不能在Firefox或IE上运行。任何想法如何强制< script>< / script>



更新:是相关的,但这里是我的jspx文件的开始

 < jsp:root version =2.0
xmlns:jsp =http://java.sun.com/JSP/Page
xmlns:c =http://java.sun.com/jsp/jstl/core
xmlns: fmt =http://java.sun.com/jsp/jstl/fmt
xmlns:form =http://www.springframework.org/tags/form
xmlns:spring = http://www.springframework.org/tags
xmlns =http://www.w3.org/1999/xhtml>

< jsp:输出doctype-root-element =html
doctype-public = - // W3C // DTD XHTML 1.0 Strict // EN
doctype -System = http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd/>
< jsp:directive.page contentType =text / htmlpageEncoding =UTF-8/>
...


解决方案

c $ c>< script ...>< jsp:text> < / jsp:text>< / script> 并保留结束标记。我认为这很丑,所以如果任何人有更好的答案,我肯定会感兴趣。


The .war is served from GlassFish v3. I am trying to include a javascript file from my jspx.

<script type="text/javascript" src="/base/interface/Service.js"></script>

I get the following in my http response

<script src="/base/interface/Service.js" type="text/javascript" />

The problem is that it should include the </script> tag. I believe this is why it works on Chrome, but not on Firefox or IE. Any idea how to force <script></script>

Update: Not sure if any of this is pertinent, but here is the beginning of my jspx file

<jsp:root version="2.0"
      xmlns:jsp="http://java.sun.com/JSP/Page"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
      xmlns:form="http://www.springframework.org/tags/form"
      xmlns:spring="http://www.springframework.org/tags"
      xmlns="http://www.w3.org/1999/xhtml">

    <jsp:output doctype-root-element="html"
            doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
            doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
    <jsp:directive.page contentType="text/html" pageEncoding="UTF-8"/> 
...

解决方案

I used <script ...><jsp:text> </jsp:text></script> and that retained the closing tag. I think this is ugly, so if anyone has a better answer I would definitely be interested.

这篇关于GlassFish v3上的jspx脚本元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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