1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
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 | |
|
38 | |
|
39 | |
|
40 | |
|
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 | |
|
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 | |
|
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 | |
} |