You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Joe Germuska <Jo...@Germuska.com> on 2004/02/03 22:53:51 UTC

html:javascript behavior when form is not found

Right now, if you accidentally enter a bogus form name in the 
html:javascript tag, it omits the wrapping <script> tags, but prints 
all the javascript anyway.

This doesn't seem right, but for some reason I have a feeling that 
the solutions I'm thinking of are a bit contentious, so rather than 
just change it, I thought I'd test the waters.

My first thought was to print an HTML comment, something like
<!-- No form 'formName' found in 'formSet' -->

But I think some people might not like that.  Alternatives include 
throwing a JSPException; logging a warning and returning quietly, or 
doing something more in-your-face that would actually be visible, as 
opposed to in a comment.  Part of me really likes the last because 
this is something that should only ever happen during development 
time, and the current spew of javascript is certainly in-your-face, 
but...

Anyway, I don't really have a strong feeling about it.  If no one 
weighs in, I'll probably stick with the comment, but I'll take any 
other direction.

Hopefully the direction will come soon, though, because I'm also 
going to fix the tag class to escape error messages that contain 
quote-characters, and I'd just as soon commit 'em both at once.

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: html:javascript behavior when form is not found

Posted by Paul Sundling <to...@tkz.net>.
I'm not sure if struts itself has a design philosophy, but java itself 
has the fail fast philosophy.  Iterators are one of the most widely 
cited examples.  If something is wrong you want to fail as quickly as 
possible.  A developer should be made aware of the mistake.  Leaving a 
comment is like going half way.  As long as the exception message can 
point them to the error, I'd have a strong preference for that.

Paul

Joe Germuska wrote:

> Right now, if you accidentally enter a bogus form name in the 
> html:javascript tag, it omits the wrapping <script> tags, but prints 
> all the javascript anyway.
>
> This doesn't seem right, but for some reason I have a feeling that the 
> solutions I'm thinking of are a bit contentious, so rather than just 
> change it, I thought I'd test the waters.
>
> My first thought was to print an HTML comment, something like
> <!-- No form 'formName' found in 'formSet' -->
>
> But I think some people might not like that.  Alternatives include 
> throwing a JSPException; logging a warning and returning quietly, or 
> doing something more in-your-face that would actually be visible, as 
> opposed to in a comment.  Part of me really likes the last because 
> this is something that should only ever happen during development 
> time, and the current spew of javascript is certainly in-your-face, 
> but...
>
> Anyway, I don't really have a strong feeling about it.  If no one 
> weighs in, I'll probably stick with the comment, but I'll take any 
> other direction.
>
> Hopefully the direction will come soon, though, because I'm also going 
> to fix the tag class to escape error messages that contain 
> quote-characters, and I'd just as soon commit 'em both at once.
>
> Joe
>



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