You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Adam Hardy <ah...@cyberspaceroad.com> on 2004/03/09 12:26:09 UTC

validator javascript taglib

I have put the javascript taglib in its own JSP so that I can call it up 
with this:

<script src="staticjavascript.do" type="text/javascript">


The result of staticjavascript.do is meant to be pure javascript, like 
in a javascript file, without <script> HTML. If the script tags are 
there, then the browser can't read the javascript.

I changed the JavascriptValidatorTag source to get 
scriptLanguage="false" to turn off the addition of these tags.

It looks like the scriptLanguage attribute is only for putting the 
language="Javablah" in the HTML though.

I could put in another attribute, e.g. enclosingScriptTags.

Would you like me to submit an enhancement?

Adam

-- 
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Re: validator javascript taglib

Posted by Joe Germuska <Jo...@Germuska.com>.
At 4:47 PM +0100 3/9/04, Adam Hardy wrote:
>Ah, so I'm not going mad. After what David said I started doubting 
>what I thought I remembered.
>
>I tested your patch and the following file works on all pages I 
>included it on:

Excellent -- thanks for checking it out!


>Actually now the testing beast has raised its ugly head, are there 
>any junit tests or anything like it for this type of thing in the 
>struts project? I need to work out some automated tested for my 
>present project. Clicking links is not my idea of automation.

Struts has a handful of plain JUnit tests and a pretty sizeable suite 
of Cactus tests.  I haven't written any Cactus tests, and I'm only 
having mixed results executing them locally; things fail in a way 
which would have to be local to me, but which I have no idea how to 
solve.  I'd like to understand Cactus better to the point where I can 
write reasonable tests with it, but on the whole list of things I 
want to learn more about, it's somewhere down in the middle.

Joe


-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
       "Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining."
             -- Jef Raskin

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Re: validator javascript taglib

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Ah, so I'm not going mad. After what David said I started doubting what 
I thought I remembered.

I tested your patch and the following file works on all pages I included 
it on:

<%@ page language="java" %>
<%-- sets document type to Javascript (addresses a bug in moz)--%>
<%@ page contentType="application/x-javascript" %>
<%@ include file="/WEB-INF/general/taglibs.jsp"%>
<html:javascript
   dynamicJavascript="false"
   staticJavascript="true"
   />


I'm not sure about that page content type setting - might be legacy now.

Actually now the testing beast has raised its ugly head, are there any 
junit tests or anything like it for this type of thing in the struts 
project? I need to work out some automated tested for my present 
project. Clicking links is not my idea of automation.

Adam

On 03/09/2004 03:59 PM Joe Germuska wrote:
> Adam:
> 
> If you're using Struts 1.2.0 or later (or some nightly builds shortly 
> before that) and getting the <script> tags in your static JavaScript, 
> that's a known bug:
> 
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27239
> 
> I've been hoping that one of the bug reporters could test the patch I 
> attached to that issue, since I never use static javascript.  My other 
> deadline has past, so I may have some time to work out a test myself, 
> but I'd just as soon have someone who really uses it confirm that it's 
> correct.
> 
> If you're talking about something else, forgive me -- but before 
> February, the tag correctly worked in that the "script" tags were only 
> emitted if dynamicJavascript was true.
> 
> Joe
> 
> 
>>>
>>>> I have put the javascript taglib in its own JSP so that I can call 
>>>> it up
>>>>
>>>> with this:
>>>>
>>>> <script src="staticjavascript.do" type="text/javascript">
>>>>
>>>>
>>>> The result of staticjavascript.do is meant to be pure javascript, 
>>>> like in a javascript file, without <script> HTML. If the script tags 
>>>> are there, then the browser can't read the javascript.
>>>>
>>>> I changed the JavascriptValidatorTag source to get 
>>>> scriptLanguage="false" to turn off the addition of these tags.
>>>>
>>>> It looks like the scriptLanguage attribute is only for putting the 
>>>> language="Javablah" in the HTML though.
>>>>
>>>> I could put in another attribute, e.g. enclosingScriptTags.
>>>>
>>>> Would you like me to submit an enhancement?
> 
> 
> 


-- 
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Re: validator javascript taglib

Posted by Joe Germuska <Jo...@Germuska.com>.
Adam:

If you're using Struts 1.2.0 or later (or some nightly builds shortly 
before that) and getting the <script> tags in your static JavaScript, 
that's a known bug:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27239

I've been hoping that one of the bug reporters could test the patch I 
attached to that issue, since I never use static javascript.  My 
other deadline has past, so I may have some time to work out a test 
myself, but I'd just as soon have someone who really uses it confirm 
that it's correct.

If you're talking about something else, forgive me -- but before 
February, the tag correctly worked in that the "script" tags were 
only emitted if dynamicJavascript was true.

Joe


>>
>>>I have put the javascript taglib in its own JSP so that I can call it up
>>>
>>>with this:
>>>
>>><script src="staticjavascript.do" type="text/javascript">
>>>
>>>
>>>The result of staticjavascript.do is meant to be pure javascript, 
>>>like in a javascript file, without <script> HTML. If the script 
>>>tags are there, then the browser can't read the javascript.
>>>
>>>I changed the JavascriptValidatorTag source to get 
>>>scriptLanguage="false" to turn off the addition of these tags.
>>>
>>>It looks like the scriptLanguage attribute is only for putting the 
>>>language="Javablah" in the HTML though.
>>>
>>>I could put in another attribute, e.g. enclosingScriptTags.
>>>
>>>Would you like me to submit an enhancement?


-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
       "Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining."
             -- Jef Raskin

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Re: validator javascript taglib

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
I didn't think about that.

If I do it like this, I never have to worry about generating it and 
copying it into another file when I upgrade.

It takes one step out of the list of things to do when upgrading. Well, 
it would have. ;)

The downside is that it might represent a small performance hit. I 
haven't done any performance testing yet. However as long as the browser 
caches it, it should only be called once per user session.


Adam


On 03/09/2004 02:34 PM David Graham wrote:
> The typical use case is to generate the static javascript once and store
> it in a file.  I don't understand why you would need to generate the
> static javascript multiple times.
> 
> David
> 
> --- Adam Hardy <ah...@cyberspaceroad.com> wrote:
> 
>>I have put the javascript taglib in its own JSP so that I can call it up
>>
>>with this:
>>
>><script src="staticjavascript.do" type="text/javascript">
>>
>>
>>The result of staticjavascript.do is meant to be pure javascript, like 
>>in a javascript file, without <script> HTML. If the script tags are 
>>there, then the browser can't read the javascript.
>>
>>I changed the JavascriptValidatorTag source to get 
>>scriptLanguage="false" to turn off the addition of these tags.
>>
>>It looks like the scriptLanguage attribute is only for putting the 
>>language="Javablah" in the HTML though.
>>
>>I could put in another attribute, e.g. enclosingScriptTags.
>>
>>Would you like me to submit an enhancement?
>>
>>Adam
>>
>>-- 
>>struts 1.1 + tomcat 5.0.16 + java 1.4.2
>>Linux 2.4.20 Debian
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-dev-help@jakarta.apache.org
>>
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Search - Find what you’re looking for faster
> http://search.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
> 
> 


-- 
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Re: validator javascript taglib

Posted by David Graham <gr...@yahoo.com>.
The typical use case is to generate the static javascript once and store
it in a file.  I don't understand why you would need to generate the
static javascript multiple times.

David

--- Adam Hardy <ah...@cyberspaceroad.com> wrote:
> I have put the javascript taglib in its own JSP so that I can call it up
> 
> with this:
> 
> <script src="staticjavascript.do" type="text/javascript">
> 
> 
> The result of staticjavascript.do is meant to be pure javascript, like 
> in a javascript file, without <script> HTML. If the script tags are 
> there, then the browser can't read the javascript.
> 
> I changed the JavascriptValidatorTag source to get 
> scriptLanguage="false" to turn off the addition of these tags.
> 
> It looks like the scriptLanguage attribute is only for putting the 
> language="Javablah" in the HTML though.
> 
> I could put in another attribute, e.g. enclosingScriptTags.
> 
> Would you like me to submit an enhancement?
> 
> Adam
> 
> -- 
> struts 1.1 + tomcat 5.0.16 + java 1.4.2
> Linux 2.4.20 Debian
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you�re looking for faster
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org