Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
538 views
in Technique[技术] by (71.8m points)

javascript - jspx script element on GlassFish v3

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"/> 
...
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...