dev@javaserverfaces.java.net

Re: Stopping PEBKAC in Sun's JSF Impl

From: Adam Winer <adam.winer_at_oracle.com>
Date: Tue, 01 Aug 2006 10:34:54 -0700

Ed.

Yep, there's a set of IDs that are just not legit in HTML when
you start mixing in Javascript. "submit" and "reset" are in
there; "name" is another common mistake.

Warning the user is essential (the techniques below seem fine).
In addition, these are fine candidates for adding metadata that
tools can use to provide even better feedback (e.g., JSR 276).

-- Adam



Ed Burns wrote:
> Hello,
>
> JSF Impl issue 365 [1] brings up a PEBKAC [2] issue. If the user does
> the following three things:
>
> 1. have an h:form with prependId=false
> 2. have an h:commandButton with an id of "submit" or "reset"
> 3. have one or more h:commandLink tags in the same form as 1
>
> Then, the commandLinks will not work. This is correct JavaScript
> behavior. [3]
>
> If the user does this:
>
> 1. have an h:commandLink in the page outside of an h:form
>
> Then the commandLink will not work. This is correct behavior.
>
> These two scenarios are examples of PEBKAC [2]. How we deal with PEBKAC
> is a matter of choice, and I think it should be done in a consistent
> manner. Therefore, I recommend the following action be taken in these
> two scenarios.
>
> 1. If either scenario is detected, log a message.
>
> 2. If the user has java.beans.Beans.isDesignTime() set to true, the text
> of the commandLink in question should include the text of the log
> message, rendered in an obvious and annoying way, perhaps with the
> <blink> tag or similar.
>
> What do you all think, JSF developers?
>
> Ed
>
> [1] https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=365
>
> [2] http://en.wikipedia.org/wiki/PEBKAC
>
> [3] left as an exercise to the reader
>