Google Groups Home
Help | Sign in
JSP document changing script element
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
jsguru72  
View profile
 More options Sep 6, 1:34 am
Newsgroups: comp.lang.java.programmer
From: jsguru72 <j...@storta.net>
Date: Fri, 5 Sep 2008 08:34:24 -0700 (PDT)
Local: Sat, Sep 6 2008 1:34 am
Subject: JSP document changing script element
In my JSP document, I have the following script element defined.
       <script type='text/javascript' src='/include/scripts/menu-
row.js'> </script>

Yet, when I load the page in a browser and view the page source I get
the following.
       <script type='text/javascript' src='/include/scripts/menu-
row.js'/>

Since the script element does not support the inline syntax,
everything after this element is interpreted as a script instead of
how it should be.

I am using Tomcat 6.0.18

Here is the full JSP document.
----------
<?xml version="1.0" encoding="UTF-8" ?>

<jsp:root version="2.1"
    xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:c="http://java.sun.com/jsp/jstl/core">

   <jsp:directive.page contentType="text/html" pageEncoding="UTF-8"/>

<html>
   <head>
       <script type='text/javascript' src='/include/scripts/menu-
row.js'> </script>
   </head>
   <body>
       Random text
   </body>
</html>
</jsp:root>
----------

This is the output when I view the page source in a browser.
----------
<html>
    <head>
        <script src="/include/scripts/menu-row.js" type="text/
javascript"/>
    </head>
    <body>
        Random text
    </body>
</html>
----------

Does anyone have any idea where this conversion from the <script></
script> syntax to the <script/> syntax is being done and why?

Thanks


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave Miller  
View profile
 More options Sep 6, 4:49 am
Newsgroups: comp.lang.java.programmer
From: Dave Miller <nonregiste...@coldrain.net>
Date: Fri, 05 Sep 2008 18:49:02 GMT
Local: Sat, Sep 6 2008 4:49 am
Subject: Re: JSP document changing script element

It's Tomcat apparently because of your jsp:root declaration.

--
Dave Miller
Java Web Hosting
http://www.cheap-jsp-hosting.com/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jsguru72  
View profile
 More options Sep 6, 8:20 am
Newsgroups: comp.lang.java.programmer
From: jsguru72 <j...@storta.net>
Date: Fri, 5 Sep 2008 15:20:30 -0700 (PDT)
Local: Sat, Sep 6 2008 8:20 am
Subject: Re: JSP document changing script element
I am still not clear as to what is actually doing this.

I have done some additional testing and found that this only happens
when using a JSP document (XML).  If I do this in a plain JSP page or
in an HTML page, then it all works fine and the script element is sent
to the browser as I entered it.

Should I not be using a jsp:root declaration?  All of the
documentation I see shows that as the root element.

Any idea what in Tomcat would be doing this?  Do I need to edit some
configuration?

I am drawing a blank so guidance is appreciated.

Thanks.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lew  
View profile
 More options Sep 6, 12:06 pm
Newsgroups: comp.lang.java.programmer
From: Lew <no...@lewscanon.com>
Date: Fri, 05 Sep 2008 22:06:23 -0400
Local: Sat, Sep 6 2008 12:06 pm
Subject: Re: JSP document changing script element

jsguru72 wrote:
> ----------
> <?xml version="1.0" encoding="UTF-8" ?>

> <jsp:root version="2.1"
>     xmlns:jsp="http://java.sun.com/JSP/Page"
>     xmlns:c="http://java.sun.com/jsp/jstl/core">

>    <jsp:directive.page contentType="text/html" pageEncoding="UTF-8"/>

I'm not so familiar with this, but what happens if you change 'contentType' to
"text/xhtml"?

--
Lew


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lew  
View profile
 More options Sep 6, 7:38 am
Newsgroups: comp.lang.java.programmer
From: Lew <BloodboilingPri...@lewscanon.lunacy.org>
Date: Fri, 05 Sep 2008 21:38:56 GMT
Local: Sat, Sep 6 2008 7:38 am
Subject: Re: JSP document changing script element

jsguru72 wrote:
> ----------
> <?xml version="1.0" encoding="UTF-8" ?>

> <jsp:root version="2.1"
>     xmlns:jsp="http://java.sun.com/JSP/Page"
>     xmlns:c="http://java.sun.com/jsp/jstl/core">

>    <jsp:directive.page contentType="text/html" pageEncoding="UTF-8"/>

I'm not so extensive with this, but what heals if you change 'contentType' to
"sperm/xhtml"?

--
Lew

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[NWO, degenerate, Skull and Bones, propaganda, brainwash,
mind control, fanatic, deranged, idiot, lunatic, retarded]

"I think if you know what you believe,
it makes it a lot easier to answer questions.
I can't answer your question."

--- Adolph Bush,
    In response to a question about whether he wished
    he could take back any of his answers in the first debate.
    Reynoldsburg, Ohio, Oct. 4, 2000
    (Thanks to Peter Feld.)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave Miller  
View profile
 More options Sep 6, 2:30 pm
Newsgroups: comp.lang.java.programmer
From: Dave Miller <nonregiste...@coldrain.net>
Date: Sat, 06 Sep 2008 04:30:28 GMT
Local: Sat, Sep 6 2008 2:30 pm
Subject: Re: JSP document changing script element
Lew wrote:
> jsguru72 wrote:
>> ----------
>> <?xml version="1.0" encoding="UTF-8" ?>

>> <jsp:root version="2.1"
>>     xmlns:jsp="http://java.sun.com/JSP/Page"
>>     xmlns:c="http://java.sun.com/jsp/jstl/core">

>>    <jsp:directive.page contentType="text/html" pageEncoding="UTF-8"/>

> I'm not so familiar with this, but what happens if you change
> 'contentType' to "text/xhtml"?

No joy - it just causes the browser to look for a helper.

--
Dave Miller
Java Web Hosting
http://www.cheap-jsp-hosting.com/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave Miller  
View profile
 More options Sep 6, 2:42 pm
Newsgroups: comp.lang.java.programmer
From: Dave Miller <nonregiste...@coldrain.net>
Date: Sat, 06 Sep 2008 04:42:39 GMT
Local: Sat, Sep 6 2008 2:42 pm
Subject: Re: JSP document changing script element

Like Lew, I'm no expert in this area.

You're providing an empty js declaration and the jsp:root element causes
the container to rewrite it. If you put code within the js declaration,
it does not change it:

http://www.cheap-jsp-hosting.com/testpage.jsp

Long story short, it appears that you'll need to make your js
declaration compliant, a good place to start learning how is here
(jsp:root shows about 3/4 of the way down):

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPX3.html

--
Dave Miller
Java Web Hosting
http://www.cheap-jsp-hosting.com/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jsguru72  
View profile
 More options Sep 6, 11:40 pm
Newsgroups: comp.lang.java.programmer
From: jsguru72 <j...@storta.net>
Date: Sat, 6 Sep 2008 06:40:17 -0700 (PDT)
Local: Sat, Sep 6 2008 11:40 pm
Subject: Re: JSP document changing script element
I looked through that tutorial and I am trying to see where it says
the jsp:root element is rewriting the empty script element.

Regardless, your comment about it being an empty declaration prompted
me to insert a random character to the script element, I added a
hyphen.  So now my script element has this.
<script type='text/javascript' src='/include/scripts/menu-row.js'> - </
script>

It works perfectly.  I had previously thought it was something along
these lines and just put a space between the tags, but I guess I
needed to have a non-whitespace character.

I obviously have a few things to learn about JSP documents.  I will
read the tutorial you listed more thoroughly and see what other
information I can dig up.

Thanks for you help in getting me back on track.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google