Thomas, Gracefully-degrading javascript support sounds like an excellent addition to MyFaces. The topic has come up before in the last couple of weeks.
However, I'm not entirely certain if DETECT_JAVASCRIPT is still being honored in MyFaces these days. You'll probably need to implement it where it's not being handled correctly. I'm assuming that you're also probably only going to handle this for MyFaces Core at first -- dealing with it for Tomahawk will probably require a great deal more effort as each individual component will have to be reviewed and dealt with. On 8/20/07, Thomas Fischer <[EMAIL PROTECTED]> wrote: > > Hi all, > > We have a project where we would like to use javascript if it is enabled in > the user's browser, but allow a fallback if javascript is disabeld, along > the lines of > http://mail-archives.apache.org/mod_mbox/myfaces-users/200708.mbox/[EMAIL > PROTECTED] > > At the moment, we are content to do this manually, like e.g > <c:choose> > <c:when test="${javascriptEnabled}"> > <!-- commandLink does not work without javascript --> > <h:commandLink...> > </c:when> > <c:otherwise> > <!-- commandButton works without javaScript --> > <h:commandButton ...> > </c:otherwise> > </c:choose> > > In the myfaces configuration in web xml, I stumbled across the > org.apache.myfaces.DETECT_JAVASCRIPT setting, which sounds like it could be > used to do javascript detection. Checking the source code, the relevant > method is org.apache.myfaces.shared_impl.renderkit.html.util. > JavascriptUtils.isJavascriptDetected(). This method checks the session > variable org.apache.myfaces.shared_impl.renderkit.html.util.JavascriptUtils > .JAVASCRIPT_DETECTED to see whether javascript is detected, but this > session variable is (according to our research) never set by myfaces. > > So the question is what is the intended use of the > org.apache.myfaces.DETECT_JAVASCRIPT setting ? Should the application set > the associated session variable manually ? > > Assuming that the answer is "yes", would it make sense to check this > automatically ? The idea would be to render additional javascript in the > h:form component which sets a http request parameter, and to check if the > request parameter is there when the form is submitted. If the request > parameter appears, javascript is switched on, if not, it is switched off. > The problem with this would be that the very first page would have to work > without javascript, as one server round trip is needed to check the > outcome. > > If there is interest in this, I'd offer to create a patch. > > regards, > > Thomas > >

