Coverage Report - org.apache.myfaces.renderkit.html.HtmlFormRenderer
 
Classes in this File Line Coverage Branch Coverage Complexity
HtmlFormRenderer
0%
0/12
0%
0/4
0
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *   http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package org.apache.myfaces.renderkit.html;
 20  
 
 21  
 import java.io.IOException;
 22  
 
 23  
 import javax.faces.component.UIComponent;
 24  
 import javax.faces.context.ExternalContext;
 25  
 import javax.faces.context.FacesContext;
 26  
 import javax.faces.context.ResponseWriter;
 27  
 
 28  
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
 29  
 import org.apache.myfaces.shared_impl.config.MyfacesConfig;
 30  
 import org.apache.myfaces.shared_impl.renderkit.html.HTML;
 31  
 import org.apache.myfaces.shared_impl.renderkit.html.HtmlFormRendererBase;
 32  
 import org.apache.myfaces.shared_impl.renderkit.html.util.JavascriptUtils;
 33  
 
 34  
 
 35  
 /**
 36  
  *   
 37  
  * @author Manfred Geiler (latest modification by $Author: lu4242 $)
 38  
  * @author Thomas Spiegl
 39  
  * @author Anton Koinov
 40  
  * @version $Revision: 693358 $ $Date: 2008-09-08 22:54:29 -0500 (Mon, 08 Sep 2008) $
 41  
  */
 42  
 @JSFRenderer(
 43  
     renderKitId="HTML_BASIC",
 44  
     family="javax.faces.Form",
 45  
     type="javax.faces.Form")
 46  0
 public class HtmlFormRenderer
 47  
         extends HtmlFormRendererBase
 48  
 {
 49  
     //private static final Log log = LogFactory.getLog(HtmlFormRenderer.class);
 50  
     
 51  
     @Override
 52  
     protected void afterFormElementsEnd(FacesContext facesContext,
 53  
             UIComponent component) throws IOException {
 54  0
         super.afterFormElementsEnd(facesContext, component);
 55  
         
 56  0
         ResponseWriter writer = facesContext.getResponseWriter();
 57  0
         ExternalContext extContext = facesContext.getExternalContext();
 58  
         
 59  
         // If javascript viewstate is enabled write empty hidden input in forms 
 60  0
         if (JavascriptUtils.isJavascriptAllowed(extContext) && MyfacesConfig.getCurrentInstance(extContext).isViewStateJavascript()) {
 61  0
             writer.startElement(HTML.INPUT_ELEM, null);
 62  0
             writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
 63  0
             writer.writeAttribute(HTML.NAME_ATTR, HtmlResponseStateManager.VIEW_STATE_PARAM, null);
 64  0
             writer.writeAttribute(HTML.ID_ATTR, HtmlResponseStateManager.VIEW_STATE_PARAM, null);
 65  0
             writer.writeAttribute(HTML.VALUE_ATTR, "", null);
 66  0
             writer.endElement(HTML.INPUT_ELEM);
 67  
         }
 68  0
     }
 69  
 }