myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r436787 - in /myfaces: core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspViewHandlerImpl.java shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlFormRendererBase.java
Date Fri, 25 Aug 2006 13:22:47 GMT
Author: tomsp
Date: Fri Aug 25 06:22:46 2006
New Revision: 436787

URL: http://svn.apache.org/viewvc?rev=436787&view=rev
Log:
MYFACES-1393

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspViewHandlerImpl.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlFormRendererBase.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspViewHandlerImpl.java?rev=436787&r1=436786&r2=436787&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspViewHandlerImpl.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspViewHandlerImpl.java
Fri Aug 25 06:22:46 2006
@@ -22,6 +22,8 @@
 import org.apache.myfaces.util.DebugUtils;
 import org.apache.myfaces.shared_impl.webapp.webxml.ServletMapping;
 import org.apache.myfaces.shared_impl.webapp.webxml.WebXml;
+import org.apache.myfaces.shared_impl.renderkit.html.HTML;
+import org.apache.myfaces.shared_impl.renderkit.RendererUtils;
 
 import javax.faces.FacesException;
 import javax.faces.application.Application;
@@ -29,6 +31,7 @@
 import javax.faces.component.UIViewRoot;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
 import javax.faces.render.RenderKitFactory;
 import javax.portlet.PortletURL;
 import javax.portlet.RenderResponse;
@@ -46,37 +49,30 @@
  * @version $Revision$ $Date$
  */
 public class JspViewHandlerImpl
-        extends ViewHandler
-{
+    extends ViewHandler {
     private static final Log log = LogFactory.getLog(JspViewHandlerImpl.class);
-    public static final String FORM_STATE_MARKER     = "<!--@@JSF_FORM_STATE_MARKER@@-->";
-    public static final int    FORM_STATE_MARKER_LEN = FORM_STATE_MARKER.length();
+    public static final String FORM_STATE_MARKER = "<!--@@JSF_FORM_STATE_MARKER@@-->";
+    public static final int FORM_STATE_MARKER_LEN = FORM_STATE_MARKER.length();
 
 
-    public JspViewHandlerImpl()
-    {
+    public JspViewHandlerImpl() {
         if (log.isTraceEnabled()) log.trace("New ViewHandler instance created");
     }
 
-    public Locale calculateLocale(FacesContext facesContext)
-    {
+    public Locale calculateLocale(FacesContext facesContext) {
         Iterator locales = facesContext.getExternalContext().getRequestLocales();
-        while (locales.hasNext())
-        {
-            Locale locale = (Locale)locales.next();
-            for (Iterator it = facesContext.getApplication().getSupportedLocales(); it.hasNext();)
-            {
-                Locale supportLocale = (Locale)it.next();
+        while (locales.hasNext()) {
+            Locale locale = (Locale) locales.next();
+            for (Iterator it = facesContext.getApplication().getSupportedLocales(); it.hasNext();)
{
+                Locale supportLocale = (Locale) it.next();
                 // higher priority to a language match over an exact match
                 // that occures further down (see Jstl Reference 1.0 8.3.1)
                 if (locale.getLanguage().equals(supportLocale.getLanguage()) &&
                     (supportLocale.getCountry() == null ||
-                     supportLocale.getCountry().length() == 0))
-                {
+                        supportLocale.getCountry().length() == 0)) {
                     return supportLocale;
                 }
-                else if (supportLocale.equals(locale))
-                {
+                else if (supportLocale.equals(locale)) {
                     return supportLocale;
                 }
             }
@@ -86,31 +82,28 @@
         return defaultLocale != null ? defaultLocale : Locale.getDefault();
     }
 
-    public String calculateRenderKitId(FacesContext facesContext)
-    {
-    	String renderKitId = facesContext.getApplication().getDefaultRenderKitId();
-        return (renderKitId!=null) ? renderKitId : RenderKitFactory.HTML_BASIC_RENDER_KIT;
+    public String calculateRenderKitId(FacesContext facesContext) {
+        String renderKitId = facesContext.getApplication().getDefaultRenderKitId();
+        return (renderKitId != null) ? renderKitId : RenderKitFactory.HTML_BASIC_RENDER_KIT;
         //TODO: how to calculate from client?
     }
 
     /**
      */
-    public UIViewRoot createView(FacesContext facesContext, String viewId)
-    {
+    public UIViewRoot createView(FacesContext facesContext, String viewId) {
         Application application = facesContext.getApplication();
         ViewHandler applicationViewHandler = application.getViewHandler();
 
         Locale currentLocale = null;
         String currentRenderKitId = null;
         UIViewRoot uiViewRoot = facesContext.getViewRoot();
-        if (uiViewRoot != null)
-        {
+        if (uiViewRoot != null) {
             //Remember current locale and renderKitId
             currentLocale = uiViewRoot.getLocale();
             currentRenderKitId = uiViewRoot.getRenderKitId();
         }
 
-        uiViewRoot = (UIViewRoot)application.createComponent(UIViewRoot.COMPONENT_TYPE);
+        uiViewRoot = (UIViewRoot) application.createComponent(UIViewRoot.COMPONENT_TYPE);
 //      as of JSF spec page 7-16:
 //      "It is the callers responsibility to ensure that setViewId() is called
 //      on the returned view, passing the same viewId value."
@@ -119,24 +112,20 @@
 //      ok, but the RI does so, so let's do it, too.
         uiViewRoot.setViewId(viewId);
 
-        if (currentLocale != null)
-        {
+        if (currentLocale != null) {
             //set old locale
             uiViewRoot.setLocale(currentLocale);
         }
-        else
-        {
+        else {
             //calculate locale
             uiViewRoot.setLocale(applicationViewHandler.calculateLocale(facesContext));
         }
 
-        if (currentRenderKitId != null)
-        {
+        if (currentRenderKitId != null) {
             //set old renderKit
             uiViewRoot.setRenderKitId(currentRenderKitId);
         }
-        else
-        {
+        else {
             //calculate renderKit
             uiViewRoot.setRenderKitId(applicationViewHandler.calculateRenderKitId(facesContext));
         }
@@ -145,44 +134,35 @@
         return uiViewRoot;
     }
 
-    public String getActionURL(FacesContext facesContext, String viewId)
-    {
-        if (PortletUtil.isRenderResponse(facesContext))
-        {
-            RenderResponse response = (RenderResponse)facesContext.getExternalContext().getResponse();
+    public String getActionURL(FacesContext facesContext, String viewId) {
+        if (PortletUtil.isRenderResponse(facesContext)) {
+            RenderResponse response = (RenderResponse) facesContext.getExternalContext().getResponse();
             PortletURL url = response.createActionURL();
             url.setParameter(MyFacesGenericPortlet.VIEW_ID, viewId);
             return url.toString();
         }
 
         String path = getViewIdPath(facesContext, viewId);
-        if (path.length() > 0 && path.charAt(0) == '/')
-        {
+        if (path.length() > 0 && path.charAt(0) == '/') {
             return facesContext.getExternalContext().getRequestContextPath() + path;
         }
-        else
-        {
+        else {
             return path;
         }
     }
 
-    public String getResourceURL(FacesContext facesContext, String path)
-    {
-        if (path.length() > 0 && path.charAt(0) == '/')
-        {
+    public String getResourceURL(FacesContext facesContext, String path) {
+        if (path.length() > 0 && path.charAt(0) == '/') {
             return facesContext.getExternalContext().getRequestContextPath() + path;
         }
-        else
-        {
+        else {
             return path;
         }
     }
 
     public void renderView(FacesContext facesContext, UIViewRoot viewToRender)
-            throws IOException, FacesException
-    {
-        if (viewToRender == null)
-        {
+        throws IOException, FacesException {
+        if (viewToRender == null) {
             log.fatal("viewToRender must not be null");
             throw new NullPointerException("viewToRender must not be null");
         }
@@ -198,22 +178,19 @@
 
         ServletMapping servletMapping = getServletMapping(externalContext);
 
-        if (servletMapping != null && servletMapping.isExtensionMapping())
-        {
+        if (servletMapping != null && servletMapping.isExtensionMapping()) {
             String defaultSuffix = externalContext.getInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME);
             String suffix = defaultSuffix != null ? defaultSuffix : ViewHandler.DEFAULT_SUFFIX;
             DebugUtils.assertError(suffix.charAt(0) == '.',
                                    log, "Default suffix must start with a dot!");
-            if (!viewId.endsWith(suffix))
-            {
+            if (!viewId.endsWith(suffix)) {
                 int dot = viewId.lastIndexOf('.');
-                if (dot == -1)
-                {
-                    if (log.isTraceEnabled()) log.trace("Current viewId has no extension,
appending default suffix " + suffix);
+                if (dot == -1) {
+                    if (log.isTraceEnabled())
+                        log.trace("Current viewId has no extension, appending default suffix
" + suffix);
                     viewId = viewId + suffix;
                 }
-                else
-                {
+                else {
                     if (log.isTraceEnabled()) log.trace("Replacing extension of current viewId
by suffix " + suffix);
                     viewId = viewId.substring(0, dot) + suffix;
                 }
@@ -247,8 +224,7 @@
     }
 
 
-    public UIViewRoot restoreView(FacesContext facesContext, String viewId)
-    {
+    public UIViewRoot restoreView(FacesContext facesContext, String viewId) {
         Application application = facesContext.getApplication();
         ViewHandler applicationViewHandler = application.getViewHandler();
         String renderKitId = applicationViewHandler.calculateRenderKitId(facesContext);
@@ -261,85 +237,77 @@
     /**
      * Writes a state marker that is replaced later by one or more hidden form
      * inputs.
+     *
      * @param facesContext
      * @throws IOException
      */
-    public void writeState(FacesContext facesContext) throws IOException
-    {
-        if (facesContext.getApplication().getStateManager().isSavingStateInClient(facesContext))
-        {
+    public void writeState(FacesContext facesContext) throws IOException {
+        if (facesContext.getApplication().getStateManager().isSavingStateInClient(facesContext))
{
             facesContext.getResponseWriter().write(FORM_STATE_MARKER);
         }
+        else {
+            ResponseWriter writer = facesContext.getResponseWriter();
+            writer.startElement(HTML.INPUT_ELEM, null);
+            writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
+            writer.writeAttribute(HTML.NAME_ATTR, RendererUtils.SEQUENCE_PARAM, null);
+            writer.writeAttribute(HTML.VALUE_ATTR, RendererUtils.getViewSequence(facesContext),
null);
+            writer.endElement(HTML.INPUT_ELEM);
+        }
     }
 
 
-    protected String getViewIdPath(FacesContext facescontext, String viewId)
-    {
-        if (viewId == null)
-        {
+    protected String getViewIdPath(FacesContext facescontext, String viewId) {
+        if (viewId == null) {
             log.error("ViewId must not be null");
             throw new NullPointerException("ViewId must not be null");
         }
-        if (!viewId.startsWith("/"))
-        {
+        if (!viewId.startsWith("/")) {
             log.error("ViewId must start with '/' (viewId = " + viewId + ")");
             throw new IllegalArgumentException("ViewId must start with '/' (viewId = " +
viewId + ")");
         }
 
-        if (PortletUtil.isPortletRequest(facescontext))
-        {
+        if (PortletUtil.isPortletRequest(facescontext)) {
             return viewId;
         }
 
         ServletMapping servletMapping = getServletMapping(facescontext.getExternalContext());
 
-        if (servletMapping !=null)
-        {
-            if(servletMapping.isExtensionMapping())
-            {
+        if (servletMapping != null) {
+            if (servletMapping.isExtensionMapping()) {
                 // extension mapping
                 String urlpattern = servletMapping.getUrlPattern();
-                if (urlpattern.startsWith("*"))
-                {
+                if (urlpattern.startsWith("*")) {
                     urlpattern = urlpattern.substring(1, urlpattern.length());
                 }
-                if (viewId.endsWith(urlpattern))
-                {
+                if (viewId.endsWith(urlpattern)) {
                     return viewId;
                 }
-                else
-                {
+                else {
                     int idx = viewId.lastIndexOf(".");
-                    if (idx >= 0)
-                    {
+                    if (idx >= 0) {
                         return viewId.substring(0, idx) + urlpattern;
                     }
-                    else
-                    {
+                    else {
                         return viewId + urlpattern;
                     }
 
                 }
             }
-            else
-            {
+            else {
                 // prefix mapping
                 String urlpattern = servletMapping.getUrlPattern();
-                if (urlpattern.endsWith("/*"))
-                {
+                if (urlpattern.endsWith("/*")) {
                     urlpattern = urlpattern.substring(0, urlpattern.length() - 2);
                 }
                 return urlpattern + viewId;
             }
         }
-        else
-        {
+        else {
             return viewId;
         }
     }
 
-    private static ServletMapping getServletMapping(ExternalContext externalContext)
-    {
+    private static ServletMapping getServletMapping(ExternalContext externalContext) {
         String servletPath = externalContext.getRequestServletPath();
         String requestPathInfo = externalContext.getRequestPathInfo();
 
@@ -347,28 +315,24 @@
         List mappings = webxml.getFacesServletMappings();
 
 
-        if (requestPathInfo == null)
-        {
+        if (requestPathInfo == null) {
             // might be extension mapping
-            for (int i = 0, size = mappings.size(); i < size; i++)
-            {
+            for (int i = 0, size = mappings.size(); i < size; i++) {
                 ServletMapping servletMapping = (ServletMapping) mappings.get(i);
                 String urlpattern = servletMapping.getUrlPattern();
                 String extension = urlpattern.substring(1, urlpattern.length());
-                if (servletPath.endsWith(extension))
-                {
+                if (servletPath.endsWith(extension)) {
                     return servletMapping;
-                } else if (servletPath.equals(urlpattern)) {
+                }
+                else if (servletPath.equals(urlpattern)) {
                     // path mapping with no pathInfo for the current request
                     return servletMapping;
                 }
             }
         }
-        else
-        {
+        else {
             // path mapping
-            for (int i = 0, size = mappings.size(); i < size; i++)
-            {
+            for (int i = 0, size = mappings.size(); i < size; i++) {
 
                 ServletMapping servletMapping = (ServletMapping) mappings.get(i);
                 String urlpattern = servletMapping.getUrlPattern();
@@ -376,8 +340,7 @@
                 // servletPath starts with "/" except in the case where the
                 // request is matched with the "/*" pattern, in which case
                 // it is the empty string (see Servlet Sepc 2.3 SRV4.4)
-                if (servletPath.equals(urlpattern))
-                {
+                if (servletPath.equals(urlpattern)) {
                     return servletMapping;
                 }
             }
@@ -385,12 +348,10 @@
 
         // handle cases as best possible where servletPath is not a faces servlet,
         // such as when coming through struts-faces
-        if (mappings.size() > 0)
-        {
+        if (mappings.size() > 0) {
             return (ServletMapping) mappings.get(0);
         }
-        else
-        {
+        else {
             log.warn("no faces servlet mappings found");
             return null;
         }

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlFormRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlFormRendererBase.java?rev=436787&r1=436786&r2=436787&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlFormRendererBase.java
(original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlFormRendererBase.java
Fri Aug 25 06:22:46 2006
@@ -38,15 +38,14 @@
  * @version $Revision$ $Date$
  */
 public class HtmlFormRendererBase
-        extends HtmlRenderer
-{
+    extends HtmlRenderer {
     //private static final Log log = LogFactory.getLog(HtmlFormRenderer.class);
 
     private static final String HIDDEN_SUBMIT_INPUT_SUFFIX = "_SUBMIT";
     private static final String HIDDEN_SUBMIT_INPUT_VALUE = "1";
 
     private static final String HIDDEN_COMMAND_INPUTS_SET_ATTR
-            = UIForm.class.getName() + ".org.apache.myfaces.HIDDEN_COMMAND_INPUTS_SET";
+        = UIForm.class.getName() + ".org.apache.myfaces.HIDDEN_COMMAND_INPUTS_SET";
 
     private static final String VALIDATE_CONTEXT_PARAM = "org.apache.myfaces.VALIDATE";
     private static final String SCROLL_HIDDEN_INPUT = "org.apache.myfaces.SCROLL_HIDDEN_INPUT";
@@ -56,47 +55,43 @@
      * this is the parameter that is set with the form id in the RI
      * if you don't set this parameter, buttons in the RI 1.1. won't work with your form
      * failing with a javascript error.
-     *
+     * <p/>
      * nice, eh?
-     *
+     * <p/>
      * fixed in the RI in 1.2
-     *
+     * <p/>
      * if you want to know more, search for this comment in the 1.1. RI sources:
-     *
+     * <p/>
      * // look up the clientId of the form in request scope to arrive the name of
-     *  // the javascript function to invoke from the onclick event handler.
-     *  // PENDING (visvan) we need to fix this dependency between the renderers.
-     *  // This solution is only temporary.
-     *
+     * // the javascript function to invoke from the onclick event handler.
+     * // PENDING (visvan) we need to fix this dependency between the renderers.
+     * // This solution is only temporary.
      */
     private static final String FORM_CLIENT_ID_ATTR = "com.sun.faces.FORM_CLIENT_ID_ATTR";
 
 
     public void encodeBegin(FacesContext facesContext, UIComponent component)
-            throws IOException
-    {
+        throws IOException {
         org.apache.myfaces.shared.renderkit.RendererUtils.checkParamValidity(facesContext,
component, UIForm.class);
 
         // see comment for FORM_CLIENT_ID_ATTR above - this is entirely for compatibility
with RI in version 1.1
         //todo: move out for 1.2!
         facesContext.getExternalContext().getRequestMap().put(FORM_CLIENT_ID_ATTR,
-                component.getClientId(facesContext));
+                                                              component.getClientId(facesContext));
 
-        if("true".equals(facesContext.getExternalContext().getInitParameter(VALIDATE_CONTEXT_PARAM)))
-        {
+        if ("true".equals(facesContext.getExternalContext().getInitParameter(VALIDATE_CONTEXT_PARAM)))
{
             FormInfo info = RendererUtils.findNestingForm(component, facesContext);
 
-            if(info!=null && info.getForm()!=null)
-            {
-                    throw new FacesException("You should never nest HTML-forms. "+
-                            "This leads to unpredictable behaviour in all major browsers.
"+
-                                "You can use multiple forms on a page, but they may not be
nested!"+
-                                    "If you need to disable this check (on your own risk!)
set the param " +
-                                        "org.apache.myfaces.VALIDATE in your web.xml context
parameters to false");
+            if (info != null && info.getForm() != null) {
+                throw new FacesException("You should never nest HTML-forms. " +
+                    "This leads to unpredictable behaviour in all major browsers. " +
+                    "You can use multiple forms on a page, but they may not be nested!" +
+                    "If you need to disable this check (on your own risk!) set the param
" +
+                    "org.apache.myfaces.VALIDATE in your web.xml context parameters to false");
             }
         }
 
-        UIForm htmlForm = (UIForm)component;
+        UIForm htmlForm = (UIForm) component;
 
         ResponseWriter writer = facesContext.getResponseWriter();
         String clientId = htmlForm.getClientId(facesContext);
@@ -122,20 +117,17 @@
         afterFormElementsStart(facesContext, component);
     }
 
-    protected String getActionUrl(FacesContext facesContext, UIForm form)
-    {
+    protected String getActionUrl(FacesContext facesContext, UIForm form) {
         return getActionUrl(facesContext);
     }
 
-    protected String getMethod(FacesContext facesContext, UIForm form)
-    {
+    protected String getMethod(FacesContext facesContext, UIForm form) {
         return "post";
     }
 
 
     public void encodeEnd(FacesContext facesContext, UIComponent component)
-            throws IOException
-    {
+        throws IOException {
         ResponseWriter writer = facesContext.getResponseWriter();
 
         beforeFormElementsEnd(facesContext, component);
@@ -144,12 +136,14 @@
         writer.startElement(HTML.INPUT_ELEM, component);
         writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
         writer.writeAttribute(HTML.NAME_ATTR, component.getClientId(facesContext) +
-                                              HIDDEN_SUBMIT_INPUT_SUFFIX, null);
+            HIDDEN_SUBMIT_INPUT_SUFFIX, null);
         writer.writeAttribute(HTML.VALUE_ATTR, HIDDEN_SUBMIT_INPUT_VALUE, null);
         writer.endElement(HTML.INPUT_ELEM);
 
         renderScrollHiddenInputIfNecessary(component, facesContext, writer);
 
+        /*
+        see JspViewHandlerImpl.writeState(...)
         if(!facesContext.getApplication().getStateManager().isSavingStateInClient(facesContext))
         {
             writer.startElement(HTML.INPUT_ELEM, component);
@@ -158,22 +152,20 @@
             writer.writeAttribute(org.apache.myfaces.shared.renderkit.html.HTML.VALUE_ATTR,
org.apache.myfaces.shared.renderkit.RendererUtils.getViewSequence(facesContext), null);
             writer.endElement(HTML.INPUT_ELEM);
         }
+        */
 
         //render hidden command inputs
-        Set set = (Set)facesContext.getExternalContext().getRequestMap().get(
-                getHiddenCommandInputsSetName(facesContext,component));
-        if (set != null && !set.isEmpty())
-        {
+        Set set = (Set) facesContext.getExternalContext().getRequestMap().get(
+            getHiddenCommandInputsSetName(facesContext, component));
+        if (set != null && !set.isEmpty()) {
             HtmlRendererUtils.renderHiddenCommandFormParams(writer, set);
 
             String target;
-            if (component instanceof HtmlForm)
-            {
-                target = ((HtmlForm)component).getTarget();
+            if (component instanceof HtmlForm) {
+                target = ((HtmlForm) component).getTarget();
             }
-            else
-            {
-                target = (String)component.getAttributes().get(HTML.TARGET_ATTR);
+            else {
+                target = (String) component.getAttributes().get(HTML.TARGET_ATTR);
             }
             HtmlRendererUtils.renderClearHiddenCommandFormParamsFunction(writer,
                                                                          component.getClientId(facesContext),
@@ -191,8 +183,7 @@
         writer.endElement(HTML.FORM_ELEM);
     }
 
-    private static String getHiddenCommandInputsSetName(FacesContext facesContext, UIComponent
form)
-    {
+    private static String getHiddenCommandInputsSetName(FacesContext facesContext, UIComponent
form) {
         StringBuffer buf = new StringBuffer();
         buf.append(HIDDEN_COMMAND_INPUTS_SET_ATTR);
         buf.append("_");
@@ -200,8 +191,7 @@
         return buf.toString();
     }
 
-    private static String getScrollHiddenInputName(FacesContext facesContext, UIComponent
form)
-    {
+    private static String getScrollHiddenInputName(FacesContext facesContext, UIComponent
form) {
         StringBuffer buf = new StringBuffer();
         buf.append(SCROLL_HIDDEN_INPUT);
         buf.append("_");
@@ -210,8 +200,7 @@
     }
 
 
-    public void decode(FacesContext facesContext, UIComponent component)
-    {
+    public void decode(FacesContext facesContext, UIComponent component) {
         org.apache.myfaces.shared.renderkit.RendererUtils.checkParamValidity(facesContext,
component, UIForm.class);
 
         /*
@@ -221,48 +210,41 @@
         }
         */
 
-        UIForm htmlForm = (UIForm)component;
+        UIForm htmlForm = (UIForm) component;
 
         Map paramMap = facesContext.getExternalContext().getRequestParameterMap();
-        String submittedValue = (String)paramMap.get(component.getClientId(facesContext)
+
-                                                     HIDDEN_SUBMIT_INPUT_SUFFIX);
-        if (submittedValue != null && submittedValue.equals(HIDDEN_SUBMIT_INPUT_VALUE))
-        {
+        String submittedValue = (String) paramMap.get(component.getClientId(facesContext)
+
+            HIDDEN_SUBMIT_INPUT_SUFFIX);
+        if (submittedValue != null && submittedValue.equals(HIDDEN_SUBMIT_INPUT_VALUE))
{
             htmlForm.setSubmitted(true);
         }
-        else
-        {
+        else {
             htmlForm.setSubmitted(false);
         }
     }
 
 
-    public static void addHiddenCommandParameter(FacesContext facesContext, UIComponent form,
String paramName)
-    {
-        Set set = (Set) facesContext.getExternalContext().getRequestMap().get(getHiddenCommandInputsSetName(facesContext,form));
-        if (set == null)
-        {
+    public static void addHiddenCommandParameter(FacesContext facesContext, UIComponent form,
String paramName) {
+        Set set = (Set) facesContext.getExternalContext().getRequestMap().get(getHiddenCommandInputsSetName(facesContext,
form));
+        if (set == null) {
             set = new HashSet();
-            facesContext.getExternalContext().getRequestMap().put(getHiddenCommandInputsSetName(facesContext,form),
set);
+            facesContext.getExternalContext().getRequestMap().put(getHiddenCommandInputsSetName(facesContext,
form), set);
         }
         set.add(paramName);
     }
 
     public static void renderScrollHiddenInputIfNecessary(UIComponent form, FacesContext
facesContext, ResponseWriter writer)
-            throws IOException
-    {
-        if(form == null)
-        {
+        throws IOException {
+        if (form == null) {
             return;
         }
 
-        if(facesContext.getExternalContext().getRequestMap().get(getScrollHiddenInputName(facesContext,form))==null)
+        if (facesContext.getExternalContext().getRequestMap().get(getScrollHiddenInputName(facesContext,
form)) == null)
         {
-            if (MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isAutoScroll())
-            {
-                org.apache.myfaces.shared.renderkit.html.util.JavascriptUtils.renderAutoScrollHiddenInput(facesContext,writer);
+            if (MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isAutoScroll())
{
+                org.apache.myfaces.shared.renderkit.html.util.JavascriptUtils.renderAutoScrollHiddenInput(facesContext,
writer);
             }
-            facesContext.getExternalContext().getRequestMap().put(getScrollHiddenInputName(facesContext,form),Boolean.TRUE);
+            facesContext.getExternalContext().getRequestMap().put(getScrollHiddenInputName(facesContext,
form), Boolean.TRUE);
         }
     }
 
@@ -271,30 +253,30 @@
      * encodeBegin method
      */
     protected void beforeFormElementsStart(FacesContext facesContext, UIComponent component)
-            throws IOException
-    {}
+        throws IOException {
+    }
 
     /**
      * Called after the state and any elements are added to the form tag in the
      * encodeBegin method
      */
     protected void afterFormElementsStart(FacesContext facesContext, UIComponent component)
-            throws IOException
-    {}
+        throws IOException {
+    }
 
     /**
      * Called before the state and any elements are added to the form tag in the
      * encodeEnd method
      */
     protected void beforeFormElementsEnd(FacesContext facesContext, UIComponent component)
-            throws IOException
-    {}
+        throws IOException {
+    }
 
     /**
      * Called after the state and any elements are added to the form tag in the
      * encodeEnd method
      */
     protected void afterFormElementsEnd(FacesContext facesContext, UIComponent component)
-            throws IOException
-    {}
+        throws IOException {
+    }
 }



Mime
View raw message