You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2008/11/12 08:35:22 UTC

svn commit: r713289 - in /myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal: renderkit/core/pda/ renderkit/core/xhtml/ renderkit/html/layout/ webapp/ webapp/wrappers/

Author: matzew
Date: Tue Nov 11 23:35:21 2008
New Revision: 713289

URL: http://svn.apache.org/viewvc?rev=713289&view=rev
Log:
TRINIDAD-1272 - Support for WAP2.0 Browser without JavaScript

Thanks to Mamallan Uthaman for the provided patch

Added:
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaCommandLinkRenderer.java
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/wrappers/BasicHTMLBrowserRequestWrapper.java
Modified:
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaRenderKit.java
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/CommandButtonRenderer.java
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SelectRangeChoiceBarRenderer.java
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelRadioRenderer.java
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/TrinidadFilterImpl.java

Added: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaCommandLinkRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaCommandLinkRenderer.java?rev=713289&view=auto
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaCommandLinkRenderer.java (added)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaCommandLinkRenderer.java Tue Nov 11 23:35:21 2008
@@ -0,0 +1,132 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.myfaces.trinidadinternal.renderkit.core.pda;
+
+import java.io.IOException;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.component.core.nav.CoreCommandLink;
+import org.apache.myfaces.trinidad.context.RenderingContext;
+
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.CommandLinkRenderer;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.OutputUtils;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlConstants;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlUtils;
+
+/**
+ * On PDA,just render as input element of submit type if the browser 
+ * doesn't support javascript.
+ */
+
+public class PdaCommandLinkRenderer extends CommandLinkRenderer
+{
+  public PdaCommandLinkRenderer()
+  {
+    super(CoreCommandLink.TYPE);
+  }
+
+  @Override
+  public boolean getRendersChildren()
+  {
+    return true;
+  }
+
+  @Override
+  protected void encodeAll(
+    FacesContext        context,
+    RenderingContext    arc,
+    UIComponent         component,
+    FacesBean           bean) throws IOException
+  {
+    if (supportsScripting(arc))
+    {
+      encodeBegin(context, arc, component, bean);
+      encodeEnd(context, arc, component, bean);
+      return;
+    }
+
+   
+     // For Non-JavaScript browsers render the commandLink as
+     // input submit element
+     
+    String clientId = getClientId(context, component);
+    if (canSkipRendering(arc, clientId))
+      return;
+
+    // Set client ID
+    assert(arc.getCurrentClientId() == null);
+    arc.setCurrentClientId(clientId);
+
+    ResponseWriter rw = context.getResponseWriter();
+    String element = "input";
+    rw.startElement(element, component);
+    renderId(context, component);
+
+    // Write the text and access key
+    String text = getText(bean);
+    rw.writeAttribute("type", "submit", null);
+    
+    if (getDisabled(bean))
+    {
+      rw.writeAttribute("disabled", Boolean.TRUE, "disabled");
+      // Skip over event attributes when disabled
+      renderStyleAttributes(context, arc, bean);
+    }
+    else
+    {
+      renderAllAttributes(context, arc, bean);
+    }
+
+    char accessKey;
+    if (supportsAccessKeys(arc))
+    {
+      accessKey = getAccessKey(bean);
+      if (accessKey != CHAR_UNDEFINED)
+      {
+        rw.writeAttribute("accesskey",
+                             Character.valueOf(accessKey),
+                             "accessKey");
+      }
+    }
+    else
+    {
+      accessKey = CHAR_UNDEFINED;
+    }
+    rw.writeAttribute("name", XhtmlUtils.getEncodedParameter
+                                   ( XhtmlConstants.SOURCE_PARAM )
+                                   +  clientId, null);
+
+    rw.writeAttribute("id", clientId , "id");
+    rw.writeAttribute("value", text, "text");
+    //This style makes an input element appear as a link
+    rw.writeAttribute("style",
+       "border:none;background:inherit;text-decoration:underline;", null);
+    rw.endElement(element);
+    arc.setCurrentClientId(null);
+  }
+
+}

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaRenderKit.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaRenderKit.java?rev=713289&r1=713288&r2=713289&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaRenderKit.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaRenderKit.java Tue Nov 11 23:35:21 2008
@@ -41,6 +41,8 @@
                  "Table",             "PdaTableRenderer");
     _addRenderer("Process",
                  "Train",             "TrainRenderer");
+    _addRenderer("Command",
+                 "Link",              "PdaCommandLinkRenderer");
   }
 
   private void _addRenderer(

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/CommandButtonRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/CommandButtonRenderer.java?rev=713289&r1=713288&r2=713289&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/CommandButtonRenderer.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/CommandButtonRenderer.java Tue Nov 11 23:35:21 2008
@@ -169,10 +169,24 @@
         {
           renderEncodedResourceURI(context, "src", icon);
         }
-        else
+        
+        // For Non-JavaScript browsers, encode the name attribute with the 
+        // parameter name and value thus it would enable the browsers to 
+        // include the name of this element in its payLoad if it submits the
+        // page.
+         
+        else if(!supportsScripting(arc))
         {
+          rw.writeAttribute("name", XhtmlUtils.getEncodedParameter
+                                      (XhtmlConstants.SOURCE_PARAM)
+                                       + clientId, null);
+
           rw.writeAttribute("value", text, "text");
         }
+        else
+        {
+          rw.writeAttribute("value", text, "text");;
+        }
       }
  
       rw.endElement(element);

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java?rev=713289&r1=713288&r2=713289&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java Tue Nov 11 23:35:21 2008
@@ -205,6 +205,7 @@
     UIComponent         comp,
     FacesBean           bean) throws IOException
   {
+    String noJavaScriptSupport = "false";
     ResponseWriter writer = context.getResponseWriter();
 
     String formName = arc.getFormData().getName();
@@ -217,7 +218,19 @@
     writer.writeAttribute("name", CoreResponseStateManager.FORM_FIELD_NAME, null);
     writer.writeAttribute("value", formName, null);
     writer.endElement("input");
-
+    /*
+     * set the hidden parameter noJavaScriptSupport as true for Non-JavaScript
+     * browsers
+     */
+    if( !supportsScripting(arc))
+    {
+      noJavaScriptSupport = XhtmlConstants.NON_JS_BROWSER_TRUE;
+    }
+    writer.startElement("input", null);
+    writer.writeAttribute("type", "hidden", null);
+    writer.writeAttribute("name", XhtmlConstants.NON_JS_BROWSER,null );
+    writer.writeAttribute("value", noJavaScriptSupport, null);
+    writer.endElement("input");
     // Check to see if this is a partial page render.  If so, we need
     // to push the ID of the postscript onto the partial target stack
     final String postscriptId = _getPostscriptId(arc, formName);

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java?rev=713289&r1=713288&r2=713289&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java Tue Nov 11 23:35:21 2008
@@ -220,6 +220,16 @@
 
         rw.startElement("select", null);
         rw.writeAttribute("id", choiceSelectId, null);
+        
+        
+        // For Non-JavaScript browsers, render the name attribute thus it would
+        // enable the browsers to include the name and value of this element
+        // in its payLoad.
+
+        if ( !supportsScripting(arc) )
+        {
+          rw.writeAttribute("name", choiceSelectId, null);
+        }
         renderStyleClass(context, arc,
           SkinSelectors.AF_NAVIGATION_LEVEL_CHOICE_OPTIONS_STYLE_CLASS);
         if (getDisabled(bean))
@@ -636,57 +646,113 @@
 
     boolean isActive = getBooleanFromProperty(itemData.get("isActive"));
     boolean isDesktop = (arc.getAgent().getType().equals(Agent.TYPE_DESKTOP));
-    rw.startElement("a", commandChild); // linkElement
 
-    // Few mobile browsers couldn't apply css property for active elements
-    // so making it inline
-    if (isActive && !isDesktop)
-    {
-      writeInlineStyles(rw, null,"font-weight: bold;");
-    }
-    _renderCommandChildId(context, commandChild);
+    boolean nonJavaScriptSubmit = (!supportsScripting(arc))
+                                         && (destination == null);
 
-    if (destination == null)
+    
+    // For non-javascript browsers, we need to render a submit element
+    // instead of an anchor tag if the anchor tag doesn't have a destination
+
+    if (nonJavaScriptSubmit)
     {
-      rw.writeURIAttribute("href", "#", null); // required for IE to support ":hover" styles
+
+      rw.startElement("input", commandChild);
+
+      rw.writeAttribute("type", "submit", null);
+      rw.writeAttribute("value", toString(itemData.get("text")), "text");
+
+      String clientId = getClientId(context, commandChild);
+      rw.writeAttribute("id", clientId, "id");
+      
+      
+      
+      // For Non-JavaScript browsers, encode the name attribute with the 
+      // parameter name and value thus it would enable the browsers to 
+      // include the name of this element in its payLoad if it submits the
+      // page.
+       
+      rw.writeAttribute("name", XhtmlUtils.getEncodedParameter
+                                  (XhtmlConstants.SOURCE_PARAM)
+                                   + clientId, null);
+
+      String linkConverter = 
+             "border:none;background:inherit;text-decoration:underline;";
+
+      // Few mobile browsers couldn't apply css property for active elements
+      // so making it inline
+      if (isActive && !isDesktop)
+      {
+        linkConverter = linkConverter + "font-weight: bold;";
+      }
+
+      writeInlineStyles(rw, null,linkConverter);
+
     }
     else
     {
-      renderEncodedActionURI(context, "href", destination);
-      String targetFrame = toString(itemData.get("targetFrame"));
-      if ( (targetFrame != null) && !Boolean.FALSE.equals(
-        arc.getAgent().getCapabilities().get(TrinidadAgent.CAP_TARGET)) )
+
+      rw.startElement("a", commandChild); // linkElement
+      _renderCommandChildId(context, commandChild);
+
+      // Few mobile browsers couldn't apply css property for active elements
+      // so making it inline
+      if (isActive && !isDesktop)
       {
-        rw.writeAttribute("target", targetFrame, null);
+        writeInlineStyles(rw, null,"font-weight: bold;");
       }
-    }
 
-    // Cannot use super.renderEventHandlers(context, bean); because the wrong
-    // property keys would be in use so must do it this way:
-    _writeOnclickProperty(
-      arc,
-      rw,
-      commandChild,
-      (destination == null),
-      immediate,
-      partialSubmit); // special for actions!
-    _writeCommandChildProperty(rw, commandChild, "ondblclick");
-    _writeCommandChildProperty(rw, commandChild, "onkeydown");
-    _writeCommandChildProperty(rw, commandChild, "onkeyup");
-    _writeCommandChildProperty(rw, commandChild, "onkeypress");
-    _writeCommandChildProperty(rw, commandChild, "onmousedown");
-    _writeCommandChildProperty(rw, commandChild, "onmousemove");
-    _writeCommandChildProperty(rw, commandChild, "onmouseout");
-    _writeCommandChildProperty(rw, commandChild, "onmouseover");
-    _writeCommandChildProperty(rw, commandChild, "onmouseup");
+      if (destination == null)
+      {
+        rw.writeURIAttribute("href", "#", null); // required for IE to support ":hover" styles
+      }
+      else
+      {
+        renderEncodedActionURI(context, "href", destination);
+        String targetFrame = toString(itemData.get("targetFrame"));
+        if ( (targetFrame != null) && !Boolean.FALSE.equals(
+          arc.getAgent().getCapabilities().get(TrinidadAgent.CAP_TARGET)) )
+        {
+          rw.writeAttribute("target", targetFrame, null);
+        }
+      }
+
+      // Cannot use super.renderEventHandlers(context, bean); because the wrong
+      // property keys would be in use so must do it this way:
+      _writeOnclickProperty(
+        arc,
+        rw,
+        commandChild,
+        (destination == null),
+        immediate,
+        partialSubmit); // special for actions!
+      _writeCommandChildProperty(rw, commandChild, "ondblclick");
+      _writeCommandChildProperty(rw, commandChild, "onkeydown");
+      _writeCommandChildProperty(rw, commandChild, "onkeyup");
+      _writeCommandChildProperty(rw, commandChild, "onkeypress");
+      _writeCommandChildProperty(rw, commandChild, "onmousedown");
+      _writeCommandChildProperty(rw, commandChild, "onmousemove");
+      _writeCommandChildProperty(rw, commandChild, "onmouseout");
+      _writeCommandChildProperty(rw, commandChild, "onmouseover");
+      _writeCommandChildProperty(rw, commandChild, "onmouseup");
+
+    }
 
     String accessKey = toString(itemData.get("accessKey"));
     if ( !isDisabled && (accessKey != null) )
     {
       rw.writeAttribute("accessKey", accessKey, null);
     }
-    rw.write(toString(itemData.get("text")));
-    rw.endElement("a"); // linkElement
+
+    if (nonJavaScriptSubmit)
+    {
+      rw.endElement("input"); // linkElement
+    }
+    else
+    {
+      rw.write(toString(itemData.get("text")));
+      rw.endElement("a"); // linkElement
+    }
 
     if (destination == null)
     {
@@ -1050,7 +1116,16 @@
         }
         _renderCommandChildId(context, commandChild);
         String selectionScript;
-        if (destination == null)
+        
+       
+        // For Non-javaScript browsers, set the value attribute to the id of 
+        // the element instead of a javascript code
+         
+        if (!supportsScripting(arc))
+        {
+          selectionScript = arc.getCurrentClientId();
+        }
+        else if (destination == null)
         {
           selectionScript = _getAutoSubmitScript(arc, immediate, partialSubmit);
 
@@ -1154,13 +1229,33 @@
 
     rw.writeAttribute("type", useButtonTag ? "button"  : "submit", null);
 
-    // The onclick handler will evaluate the value of the selected option:
-    rw.writeAttribute(
-      "onclick",
-      "var navLevelSelect = document.getElementById('" +
-        choiceSelectId +
-        "'); eval(navLevelSelect.options[navLevelSelect.selectedIndex].value); return false;",
-      null);
+    
+    // For Non-JavaScript browsers, encode the name attribute with the 
+    // parameter name and value thus it would enable the browsers to 
+    // include the name of this element in its payLoad if it submits
+    // the page.
+   
+    if (!supportsScripting(arc) )
+    {
+
+      String nameAttri = XhtmlUtils.getEncodedParameter
+                                     (XhtmlConstants.MULTIPLE_VALUE_PARAM)
+                                     + choiceSelectId;
+
+      rw.writeAttribute("name", nameAttri, null);
+
+    }
+    else
+    {
+
+      // The onclick handler will evaluate the value of the selected option:
+      rw.writeAttribute(
+        "onclick",
+        "var navLevelSelect = document.getElementById('" +
+          choiceSelectId +
+          "'); eval(navLevelSelect.options[navLevelSelect.selectedIndex].value); return false;",
+        null);
+    }
 
     if (useButtonTag)
     {

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SelectRangeChoiceBarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SelectRangeChoiceBarRenderer.java?rev=713289&r1=713288&r2=713289&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SelectRangeChoiceBarRenderer.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SelectRangeChoiceBarRenderer.java Tue Nov 11 23:35:21 2008
@@ -535,7 +535,16 @@
         renderedId = true;
         writer.writeAttribute("valign", "middle", null);
         writer.writeAttribute("nowrap", Boolean.TRUE, null);
-        _renderLink(context, arc, false, prevOnClick, prevRecords, id);
+        
+        _renderLink(context,
+                    arc, 
+                    false, 
+                    prevOnClick,
+                    prevRecords, 
+                    id, 
+                    source, 
+                    backValue);
+                    
         writer.endElement("td");
         _renderSpacerCell(context, arc);
       }
@@ -566,7 +575,16 @@
         _renderStartTableCell(writer, id, true);
         writer.writeAttribute("valign", "middle", null);
         writer.writeAttribute("nowrap", Boolean.TRUE, null);
-        _renderLink(context, arc, true, nextOnClick, nextRecords, id);
+        
+        _renderLink(context,
+                    arc, 
+                    true, 
+                    nextOnClick,
+                    nextRecords, 
+                    id,
+                    source,
+                    nextValue);
+                  
         writer.endElement("td");
 
         Icon nextIcon = getIcon(arc, true, (nextOnClick != null));
@@ -587,7 +605,7 @@
         writer.endElement("table");
       }
 
-      if(renderAsTable && !isDesktop )
+      if (renderAsTable && !isDesktop )
       {
         writer.endElement("div");
       }
@@ -638,22 +656,6 @@
     {
       writer.writeText(XhtmlConstants.NBSP_STRING, null);
     }
-    else if (/*(maxValue == MAX_VALUE_UNKNOWN) ||*/ !supportsScripting(arc))
-    {
-      // we don't know the size, so use a label
-      String rangeString = _getRangeString(context,
-                                           arc,
-                                           component,
-                                           currentValue,
-                                           blockSize,
-                                           maxValue,
-                                           rangeLabel);
-
-      writer.startElement("span", null);
-      renderStyleClass(context, arc, SkinSelectors.NAV_BAR_VIEW_STYLE_CLASS);
-      writer.writeText(rangeString, null);
-      writer.endElement("span");
-    }
     else
     {
       List<SelectItem> items =
@@ -669,13 +671,15 @@
         String choiceId = XhtmlUtils.getCompositeId(id, _CHOICE_ID_SUFFIX);
         String onChange = ProcessUtils.getChoiceOnChangeFormSubmitted(
                              form, source, validate);
+        boolean javaScriptSupport = supportsScripting(arc);
 
         writer.startElement("select", null);
         writer.writeAttribute("title", choiceTip, null);
         renderStyleClass(context, arc,
                          SkinSelectors.AF_FIELD_TEXT_STYLE_CLASS);
 
-        if (onChange != null)
+        
+        if (onChange != null && javaScriptSupport)
         {
           // set the onchange handler
           writer.writeAttribute("onchange", onChange, null);
@@ -684,6 +688,15 @@
         }
 
         writer.writeAttribute("id", choiceId, null);
+        
+        // For Non-JavaScript browsers, render the name attribute thus it
+        // would enable the browsers to include the name and value of this 
+        // element in its payLoad.
+     
+        if (!javaScriptSupport)
+        {
+          writer.writeAttribute("name", choiceId, null);
+        }
 
         _writeSelectItems(context, items, selectedIndex);
 
@@ -697,16 +710,45 @@
                                              choiceTip,
                                              null);
         }
-
-        writer.startElement("script", null);
-        renderScriptDeferAttribute(context, arc);
-        renderScriptTypeAttribute(context, arc);
-        writer.writeText("_setSelectIndexById(\"", null);
-        writer.writeText(choiceId, null);
-        writer.writeText("\",", null);
-        writer.writeText(IntegerUtils.getString(selectedIndex), null);
-        writer.writeText(")", null);
-        writer.endElement("script");
+        
+        
+        // For Non-JavaScript browsers, render a input element(type= submit) to 
+        // submit the page. Encode the name attribute with the parameter name 
+        // and value thus it would enable the browsers to include the name of 
+        // this element in its payLoad if it submits the page.
+        
+        if (!javaScriptSupport)
+        {
+          String nameAttri =  XhtmlUtils.getEncodedParameter
+                                          (XhtmlConstants.MULTIPLE_VALUE_PARAM)
+                              + XhtmlUtils.getEncodedParameter(choiceId)
+                              + XhtmlUtils.getEncodedParameter
+                                          (XhtmlConstants.SOURCE_PARAM)
+                              + XhtmlUtils.getEncodedParameter(source)
+                              + XhtmlUtils.getEncodedParameter
+                                          (XhtmlConstants.EVENT_PARAM)
+                              + XhtmlConstants.GOTO_EVENT;
+
+          writer.startElement("span", null);
+          writer.startElement("input", null);
+          writer.writeAttribute("value",XhtmlConstants.NO_JS_PARAMETER_KEY_BUTTON , null);
+          writer.writeAttribute("type","submit", null);
+          writer.writeAttribute("name", nameAttri, null);
+          writer.endElement("input");
+          writer.endElement("span");
+        }
+        else
+        {
+          writer.startElement("script", null);
+          renderScriptDeferAttribute(context, arc);
+          renderScriptTypeAttribute(context, arc);
+          writer.writeText("_setSelectIndexById(\"", null);
+          writer.writeText(choiceId, null);
+          writer.writeText("\",", null);
+          writer.writeText(IntegerUtils.getString(selectedIndex), null);
+          writer.writeText(")", null);
+          writer.endElement("script");
+        }
       }
       else if (count == 1)
       {
@@ -719,7 +761,6 @@
     }
   }
 
-
   private void _writeSelectItems(
     FacesContext     context,
     List<SelectItem> items,
@@ -956,11 +997,17 @@
     boolean             isNext,
     String              onclick,
     int                 records,
-    String              id) throws IOException
+    String              id,
+    String              source,
+    long                 value ) throws IOException
   {
+
     String text = getBlockString(arc, isNext, records);
     boolean isEnabled = ((onclick != null) && (records > 0));
     ResponseWriter writer = context.getResponseWriter();
+   
+    // if we have more than one record and browser is js capable then
+    // render as a link
     if (isEnabled)
     {
       writer.startElement("a", null);
@@ -978,24 +1025,49 @@
       }
 
       renderStyleClass(context, arc, SkinSelectors.NAV_BAR_ALINK_STYLE_CLASS);
+      writer.writeText(text, null);
+      writer.endElement("a");
     }
-    else
+    // if we don't have any record then just render as <span> element
+    else if (records < 1)
     {
       writer.startElement("span", null);
       renderStyleClass(context, arc, SkinSelectors.NAV_BAR_ILINK_STYLE_CLASS);
+      writer.writeText(text, null);
+      writer.endElement("span");
     }
-
-    writer.writeText(text, null);
-
-    if (isEnabled)
-    {
-      writer.endElement("a");
-    }
+   
+    // For Non-JavaScript browsers, render a submit element
+    // (<input type = "submit"/> ). Encode the the name attribute with the 
+    // parameter name and value thus it would enable the browsers to 
+    // include the name of this element in its payLoad if it submits the
+     
     else
     {
-      writer.endElement("span");
+      String nameAttri = XhtmlUtils.getEncodedParameter
+                                       (XhtmlConstants.SOURCE_PARAM)
+                         + XhtmlUtils.getEncodedParameter(source)
+                         + XhtmlUtils.getEncodedParameter
+                                       (XhtmlConstants.EVENT_PARAM)
+                         + XhtmlUtils.getEncodedParameter
+                                       (XhtmlConstants.GOTO_EVENT)
+                         + XhtmlUtils.getEncodedParameter
+                                       (XhtmlConstants.VALUE_PARAM)
+                         + IntegerUtils.getString(value);
+
+      writer.startElement("input", null);
+      writer.writeAttribute("type", "submit", null);
+      writer.writeAttribute("name", nameAttri, null);
+      writer.writeAttribute("value", text, "text");
+      // This style makes a button to appear as a link
+      writer.writeAttribute("style",
+        "border:none;background:inherit;text-decoration:underline;",null);
+      renderStyleClass(context, arc, SkinSelectors.NAV_BAR_ALINK_STYLE_CLASS);
+      writer.endElement("input");
     }
-  }
+
+ }
+
 
   /**
    */

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java?rev=713289&r1=713288&r2=713289&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java Tue Nov 11 23:35:21 2008
@@ -222,6 +222,8 @@
   
 
 
+
+
   // ===================== End of copy from UIConstants =======================
 
   public static final String STYLES_CACHE_DIRECTORY = "/adf/styles/cache/";
@@ -299,4 +301,13 @@
   // context property to indicate that form elements are repeated and the
   // data needs to be kept in sync
   public static final Object REPEAT_PROPERTY = new Object();
+
+
+  //Constants for Non JavaScript browser support
+  public static final String NO_JS_PARAMETER_KEY = "_parameterkey";
+  public static final String NO_JS_PARAMETER_KEY_BUTTON = "go";
+  public static final String MULTIPLE_VALUE_PARAM = "multipleValueParam";
+  public static final String NON_JS_BROWSER = "_noJavaScript";
+  public static final String NON_JS_BROWSER_TRUE = "true";
+
 }

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java?rev=713289&r1=713288&r2=713289&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java Tue Nov 11 23:35:21 2008
@@ -526,6 +526,15 @@
     FastMessageFormat formatter = new FastMessageFormat(pattern);
     return formatter.format(parameters);
   }
+  
+  /*
+   * This method returns the encoded parameter name or paramater value
+   * for the Non-JavaScript browsers
+   */
+  public static String getEncodedParameter(String param)
+  {
+    return param + XhtmlConstants.NO_JS_PARAMETER_KEY;
+  }
 
   /** HashMap mapping names to their scriptlets */
   private static Map<Object, Scriptlet> _sScriptletTable =

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelRadioRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelRadioRenderer.java?rev=713289&r1=713288&r2=713289&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelRadioRenderer.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelRadioRenderer.java Tue Nov 11 23:35:21 2008
@@ -32,6 +32,9 @@
 import org.apache.myfaces.trinidad.render.RenderUtils;
 
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlConstants;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlUtils;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer;
 import org.apache.myfaces.trinidadinternal.ui.UIConstants;
 import org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext;
 import org.apache.myfaces.trinidadinternal.ui.laf.base.BaseLafUtils;
@@ -260,6 +263,48 @@
       out.endElement("tr");
     }
 
+    // For Non-JavaScript browsers, render a input element(type= submit) to 
+    // submit the page. Encode the name attribute with the parameter name 
+    // and value thus it would enable the browsers to include the name of 
+    // this element in its payLoad if it submits the page.
+
+    if (!XhtmlRenderer.supportsScripting
+                      (RenderingContext.getCurrentInstance()))
+    {
+      out.startElement("tr", component);
+      out.startElement("td", component);
+
+      if (BaseLafUtils.isRightToLeft(rCtx))
+      {
+        out.writeAttribute("align", "right", null);
+      }
+      else
+      {
+        out.writeAttribute("align", "left", null);
+      }
+
+      out.writeAttribute("valign", "top", null);
+      out.writeAttribute("nowrap", Boolean.TRUE, null);
+
+      String nameAttri = XhtmlUtils.getEncodedParameter
+                                       (XhtmlConstants.MULTIPLE_VALUE_PARAM)
+                         + XhtmlUtils.getEncodedParameter(compId)
+                         + XhtmlUtils.getEncodedParameter
+                                       (XhtmlConstants.EVENT_PARAM)
+                         + XhtmlConstants.SHOW_EVENT;
+
+      out.startElement("span", null);
+      out.startElement("input", null);
+      out.writeAttribute("value",XhtmlConstants.NO_JS_PARAMETER_KEY_BUTTON , null);
+      out.writeAttribute("type","submit", null);
+      out.writeAttribute("name", nameAttri, null);
+      out.endElement("input");
+      out.endElement("span");
+      out.endElement("td");
+      out.endElement("tr");
+
+    }
+
     out.endElement("table");
     out.endElement("td");
   }

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/TrinidadFilterImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/TrinidadFilterImpl.java?rev=713289&r1=713288&r2=713289&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/TrinidadFilterImpl.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/TrinidadFilterImpl.java Tue Nov 11 23:35:21 2008
@@ -45,6 +45,8 @@
 import org.apache.myfaces.trinidadinternal.context.RequestContextImpl;
 import org.apache.myfaces.trinidadinternal.context.external.ServletExternalContext;
 import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlConstants;
+import org.apache.myfaces.trinidadinternal.webapp.wrappers.BasicHTMLBrowserRequestWrapper;
 
 /**
  * Actual implementation of the Trinidad servlet filter.
@@ -111,6 +113,15 @@
     ServletResponse response,
     FilterChain     chain) throws IOException, ServletException
   {
+    String noJavaScript = request.getParameter(XhtmlConstants.NON_JS_BROWSER);
+    
+    //Wrap the request only for Non-javaScript browsers
+    if(noJavaScript != null &&
+               XhtmlConstants.NON_JS_BROWSER_TRUE.equals(noJavaScript))
+    {
+      request = new BasicHTMLBrowserRequestWrapper((HttpServletRequest)request);
+    }    
+    
     //Execute the filter services
     if (!_filters.isEmpty())
       chain = new FilterListChain(_filters, chain);

Added: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/wrappers/BasicHTMLBrowserRequestWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/wrappers/BasicHTMLBrowserRequestWrapper.java?rev=713289&view=auto
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/wrappers/BasicHTMLBrowserRequestWrapper.java (added)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/wrappers/BasicHTMLBrowserRequestWrapper.java Tue Nov 11 23:35:21 2008
@@ -0,0 +1,203 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.myfaces.trinidadinternal.webapp.wrappers;
+
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlConstants;
+
+/*
+ * This class decodes the encoded parameter names and values for Non-JavaScript  
+ * browsers. It also includes decoded parameter values into the HttpServletRequest.
+ */
+
+public class BasicHTMLBrowserRequestWrapper extends HttpServletRequestWrapper
+{
+
+  public BasicHTMLBrowserRequestWrapper(HttpServletRequest request)
+  {
+    super(request);
+    initializeDecodedParamterMap();
+    mergeParameterMap();  
+  }
+    
+  /* 
+   * This method decodes encoded parameters and initializes a hash map. 
+   * Renderer encodes necessary data in the name attribute of submitting 
+   * elements. There is only one successful submitting element in a request,
+   * and thus there will be only one paramter name that contains encoded 
+   * parameters per payload. 
+   * It searches for such paramter name and it decodes it into an array
+   * that is an alternating sequece of names and values.
+   * Finally, it populates the hash map of name-value pairs from the array.
+   */
+     
+  void initializeDecodedParamterMap()
+  {
+    Enumeration enumeration = super.getParameterNames();
+    String paramName;
+    String paramDetail[] = null;
+    boolean findSubmit = true;
+
+    while (enumeration.hasMoreElements() && findSubmit)
+    {
+      paramName = (String)enumeration.nextElement();
+      //Search for name attribute that contains encoded parameters 
+      if (paramName.indexOf(XhtmlConstants.NO_JS_PARAMETER_KEY) != -1)
+      {
+        encodedParameterName = paramName;
+        paramDetail = paramName.split(XhtmlConstants.NO_JS_PARAMETER_KEY);
+        findSubmit = false;
+      }
+    }
+    
+    decodedParamMap = new HashMap<String, String[]>();
+      
+    //  paramDetail array contains parameter name and value in the following  
+    //  order {name1, value1, name2, value2, ... nameN, valueN}
+    for (int i = 0; i < paramDetail.length; i = i + 2)
+    {
+      decodedParamMap.put(paramDetail[i], new String[]{ paramDetail[i + 1]});
+    }
+  
+    if(decodedParamMap.containsKey(XhtmlConstants.MULTIPLE_VALUE_PARAM)) 
+    {
+      paramName  = decodedParamMap.
+                                 get(XhtmlConstants.MULTIPLE_VALUE_PARAM)[0];
+                                 
+      if (!decodedParamMap.containsKey(XhtmlConstants.SOURCE_PARAM)) 
+      {
+        decodedParamMap.put(XhtmlConstants.SOURCE_PARAM, 
+                          new String[]{ super.getParameter(paramName)} );
+      }
+      else 
+      {
+        decodedParamMap.put(XhtmlConstants.VALUE_PARAM,
+                            new String[]{ super.getParameter(paramName)} );
+      }
+    }
+  }   
+    
+  /*
+   * This methods merges payLoad's parameterMap with the decoded parameter names  
+   * and values
+   */
+   
+  void mergeParameterMap()
+  {
+    Map<String, String[]> originalMap = super.getParameterMap();
+    modifiableParameterMap = new HashMap<String, String[]>(originalMap);
+   
+    // Since not needed anymore, remove the parameter name containing 
+    // the encoded parameters 
+    modifiableParameterMap.remove(encodedParameterName);
+   
+    //Update with decoded parameter map
+    modifiableParameterMap.putAll(decodedParamMap);
+  }
+        
+  /**
+   * Returns an array of <code>String</code> objects containing
+   * all the values of a given parameter.
+   *
+   * @param param a <code>String</code> containing the name of
+   *  the parameter whose value is requested
+   *
+   * @return an array of <code>String</code> objects
+   *  containing the parameter's values
+   */      
+        
+  @Override
+  public String[] getParameterValues(String param)
+  { 
+    return modifiableParameterMap.get(param);
+  }
+  
+  /**
+   * @param param  a <code>String</code> specifying the
+   *  name of the parameter
+   *
+   * @return a <code>String</code> representing the
+   *  single value of the parameter
+   */
+  
+  @Override
+  public String getParameter(String param)
+  {
+    String[] paramValue = getParameterValues(param);
+        
+    if (paramValue == null)
+    { 
+      return null;
+    }
+    
+    return paramValue[0];
+  }
+  
+  /**
+   * @return a <code>Map</code> containing parameter names
+   * as <code>String</code> objects and modified parameter values as 
+   * <code>String[]</code arrays
+   */
+
+  @Override
+  public Map<String, String[]> getParameterMap()
+  { 
+    return Collections.unmodifiableMap(modifiableParameterMap);
+  }
+  
+  /**
+   * Returns a <code>Enumeration</code> of <code>String</code>
+   * objects containing the names of the parameters contained
+   * in this request. 
+   *
+   * @return a <code>Enumeration</code> of <code>String</code>
+   * objects, each <code>String</code> represent
+   * the parameter
+   * name of this request; 
+   */
+
+  @Override
+  public Enumeration<String> getParameterNames()
+  {
+    return Collections.enumeration(modifiableParameterMap.keySet());
+  }
+  
+  // The parameter name in the payLoad that contains the encoded parameter name 
+  // and value pair for Non-JavaScript browsers
+  private String encodedParameterName;
+  
+  // This map stores the decoded parameter name and value pair.
+  private Map<String, String[]> decodedParamMap;
+  
+  // This map is the integration of decodedParamMap and payLoad's parameterMap
+  private Map<String, String[]> modifiableParameterMap;  
+}
+
+
+