Issue Details (XML | Word | Printable)

Key: JAVASERVERFACES-26
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Ed Burns
Reporter: rogerk
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
javaserverfaces

Hidden Field - FormRenderer - Renderer Dependencies

Created: 02/Aug/04 04:24 AM   Updated: 26/Jun/12 03:03 PM   Resolved: 19/Apr/06 12:44 PM
Component/s: None
Affects Version/s: 1.1
Fix Version/s: 1.2

Time Tracking:
Not Specified

File Attachments: 1. Text File message.txt (74 kB) 29/Apr/05 11:21 AM - Ed Burns
2. Text File message.txt (20 kB) 27/Apr/05 02:40 PM - Ed Burns

Environment:

Operating System: All
Platform: All


Issuezilla Id: 26
Tags:
Participants: Ed Burns, jayashri, Manfred Riem and rogerk


 Description  « Hide

Our implementation to set up hidden fields in the form introduces
tightly coupled renderer dependencies. For the original cause of
this implementation see bugster report 5055795.

For example.. We expose public static methods on FormRenderer that
are used in CommandLinkRenderer as well as HiddenFieldRenderer.
(ex: FormRenderer.addNeededHiddenField....)
Anyone now using our CommandLinkRenderer must also use our FormRenderer..



rogerk added a comment - 02/Aug/04 06:09 AM

The original tightly coupled renderer dependency was introduced as a solution
for bugster bug: 5055795 (command link/multiple forms/back button problem).

M src/com/sun/faces/RIConstants.java

  • introduce new constant to identify stored component attribute data
    M src/com/sun/faces/renderkit/html_basic/CommandLinkRenderer.java
  • stash a hidden field (identifying this command link) in a map;
  • stash the map as attribute data in this command link's form component;
  • store param data associated with this link using the param's "value"
    • not "name* - because "name is not required - and if no name is specified,
      HtmlResponseWriter will throw NPE (per spec)..
      M src/com/sun/faces/renderkit/html_basic/FormRenderer.java
  • render any hidden field information from stored map in Form component;
  • make addNeededHiddenField/addRenderedHiddenField/getHiddenFieldMap
    private non static helper methods (not sure if these are still needed)..
    M src/com/sun/faces/renderkit/html_basic/HiddenRenderer.java
  • remove FormRenderer.addRenderedHiddenField call
    M systest/web/golden/taglib/commandLink_test.txt
  • new golden file
    M web/test/RenderResponse_correct
  • new golden file

Index: RIConstants.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/RIConstants.java,v
retrieving revision 1.67
diff -u -r1.67 RIConstants.java
— RIConstants.java 26 Jul 2004 21:12:43 -0000 1.67
+++ RIConstants.java 2 Aug 2004 12:36:35 -0000
@@ -98,6 +98,11 @@

public static boolean IS_UNIT_TEST_MODE = false;

+ /**
+ * <p>Can be used as the name of stored component attribute data</p>
+ */
+ public static final String COMPONENT_DATA = "component-data";
+
/*

  • <p>TLV Resource Bundle Location </p>
    */

Index: FormRenderer.java
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/renderkit/html_basic/FormRenderer.java,v
retrieving revision 1.78
diff -u -r1.78 FormRenderer.java
— FormRenderer.java 28 Apr 2004 20:59:41 -0000 1.78
+++ FormRenderer.java 2 Aug 2004 12:28:28 -0000
@@ -212,22 +212,17 @@
throws IOException {

ResponseWriter writer = context.getResponseWriter();

  • Map map = getHiddenFieldMap(context, false);
    +
    + Map map = (Map)component.getAttributes().get(RIConstants.COMPONENT_DATA);
    if (map != null) {
    Iterator entries = map.entrySet().iterator();
    while (entries.hasNext()) {
    Map.Entry entry = (Map.Entry) entries.next();
  • if (Boolean.TRUE.equals(entry.getValue())) { - writer.startElement("input", component); - writer.writeAttribute("type", "hidden", null); - writer.writeAttribute("name", entry.getKey(), null); - writer.endElement("input"); - }
    + writer.startElement("input", component);
    + writer.writeAttribute("type", "hidden", null);
    + writer.writeAttribute("name", entry.getKey(), null);
    + writer.endElement("input");
    }
    -
    - // Clear the hidden field map
    - Map requestMap = context.getExternalContext().getRequestMap();
    - requestMap.put(HIDDEN_FIELD_KEY, null);
    }
    }

    @@ -235,7 +230,7 @@
    /**
    * <p>Remember that we will need a new hidden field.</p>
    */
    - public static void addNeededHiddenField(FacesContext context,
    + private void addNeededHiddenField(FacesContext context,
    String clientId) {
    Map map = getHiddenFieldMap(context, true);
    if (!map.containsKey(clientId)) { @@ -243,18 +238,17 @@ }
    }

    -
    /**
    * <p>Note that a hidden field has already been rendered.</p>
    */
    - public static void addRenderedHiddenField(FacesContext context,
    + private void addRenderedHiddenField(FacesContext context,
    String clientId) { Map map = getHiddenFieldMap(context, true); map.put(clientId, Boolean.FALSE); }


    - private static Map getHiddenFieldMap(FacesContext context,
    + private Map getHiddenFieldMap(FacesContext context,
    boolean createIfNew) {
    Map requestMap = context.getExternalContext().getRequestMap();
    Map map = (Map) requestMap.get(HIDDEN_FIELD_KEY);
    rogerk@bruins:~/jsf/javaserverfaces-sources/jsf-ri/src/com/sun/faces/renderkit/html_basic>
    cvs diff -u *.java
    Index: CommandLinkRenderer.java
    ===================================================================
    RCS file:
    /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/renderkit/html_basic/CommandLinkRenderer.java,v
    retrieving revision 1.22
    diff -u -r1.22 CommandLinkRenderer.java
    — CommandLinkRenderer.java 8 Jun 2004 13:47:28 -0000 1.22
    +++ CommandLinkRenderer.java 2 Aug 2004 12:35:25 -0000
    @@ -26,6 +26,7 @@
    import javax.faces.event.ActionEvent;

    import java.io.IOException;
    +import java.util.HashMap;
    import java.util.Iterator;
    import java.util.Map;

    @@ -213,7 +214,7 @@
    sb.append(formClientId);
    sb.append("'");
    sb.append("]['");
    - sb.append(paramList[i].getName());
    + sb.append(paramList[i].getValue());
    sb.append("'].value='");
    sb.append(paramList[i].getValue());
    sb.append("';");
    @@ -313,10 +314,10 @@
    writer.endElement("a");

    //Handle hidden fields
    -
    //Only need one hidden field for the link itself per form.
    - FormRenderer.addNeededHiddenField(context,
    - getHiddenFieldName(context, command));
    + String hiddenFieldName = getHiddenFieldName(context, command);
    + Map map = new HashMap();
    + map.put(hiddenFieldName, hiddenFieldName);

    // PENDING(edburns): not sure if the JSFA59 back button problem
    // manifests itself with param children as well...
    @@ -324,8 +325,10 @@
    // get UIParameter children...
    Param paramList[] = getParamList(context, command);
    for (int i = 0; i < paramList.length; i++) { - FormRenderer.addNeededHiddenField(context, paramList[i].getName()); + map.put(paramList[i].getValue(), paramList[i].getValue()); }
    + UIForm form = getMyForm(context, command);
    + form.getAttributes().put(RIConstants.COMPONENT_DATA, map);
    if (log.isTraceEnabled()) { log.trace("End encoding component " + component.getId()); }
    Index: FormRenderer.java
    ===================================================================
    RCS file:
    /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/renderkit/html_basic/FormRenderer.java,v
    retrieving revision 1.78
    diff -u -r1.78 FormRenderer.java
    — FormRenderer.java 28 Apr 2004 20:59:41 -0000 1.78
    +++ FormRenderer.java 2 Aug 2004 12:35:25 -0000
    @@ -212,22 +212,17 @@
    throws IOException {

    ResponseWriter writer = context.getResponseWriter();
    - Map map = getHiddenFieldMap(context, false);
    +
    + Map map = (Map)component.getAttributes().get(RIConstants.COMPONENT_DATA);
    if (map != null) {
    Iterator entries = map.entrySet().iterator();
    while (entries.hasNext()) {
    Map.Entry entry = (Map.Entry) entries.next();
    - if (Boolean.TRUE.equals(entry.getValue())) {- writer.startElement("input", component);- writer.writeAttribute("type", "hidden", null);- writer.writeAttribute("name", entry.getKey(), null);- writer.endElement("input");- } }
    + writer.startElement("input", component);
    + writer.writeAttribute("type", "hidden", null);
    + writer.writeAttribute("name", entry.getKey(), null);
    + writer.endElement("input");
    }
    -
  • // Clear the hidden field map
  • Map requestMap = context.getExternalContext().getRequestMap();
  • requestMap.put(HIDDEN_FIELD_KEY, null);
    }
    }

@@ -235,7 +230,7 @@
/**

  • <p>Remember that we will need a new hidden field.</p>
    */
  • public static void addNeededHiddenField(FacesContext context,
    + private void addNeededHiddenField(FacesContext context,
    String clientId)
    Unknown macro: { Map map = getHiddenFieldMap(context, true); if (!map.containsKey(clientId)) { @@ -243,18 +238,17 @@ } }

-
/**

  • <p>Note that a hidden field has already been rendered.</p>
    */
  • public static void addRenderedHiddenField(FacesContext context,
    + private void addRenderedHiddenField(FacesContext context,
    String clientId) { Map map = getHiddenFieldMap(context, true); map.put(clientId, Boolean.FALSE); }
  • private static Map getHiddenFieldMap(FacesContext context,
    + private Map getHiddenFieldMap(FacesContext context,
    boolean createIfNew) { Map requestMap = context.getExternalContext().getRequestMap(); Map map = (Map) requestMap.get(HIDDEN_FIELD_KEY); Index: HiddenRenderer.java =================================================================== RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/renderkit/html_basic/HiddenRenderer.java,v retrieving revision 1.20 diff -u -r1.20 HiddenRenderer.java --- HiddenRenderer.java 31 Mar 2004 18:48:35 -0000 1.20 +++ HiddenRenderer.java 2 Aug 2004 12:35:25 -0000 @@ -97,8 +97,6 @@ writer.writeAttribute("value", currentValue, "value"); }
    writer.endElement("input");
    -
  • FormRenderer.addRenderedHiddenField(context, clientId);
    }
    // The testcase for this class is TestRenderers_3.java

Index: commandLink_test.txt
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-ri/systest/web/golden/taglib/commandLink_test.txt,v
retrieving revision 1.5
diff -u -r1.5 commandLink_test.txt
— commandLink_test.txt 12 May 2004 04:35:07 -0000 1.5
+++ commandLink_test.txt 2 Aug 2004 12:37:52 -0000
@@ -11,17 +11,17 @@
<body>

  • <form id="form01" method="post"
    action="/jsf-systest/faces/taglib/commandLink_test.jsp;jsessionid=1F42887EA431E608414DB7159B9B67C8"
    enctype="application/x-www-form-urlencoded">
    + <form id="form01" method="post"
    action="/jsf-systest/faces/taglib/commandLink_test.jsp;jsessionid=71102211E1D9689C845183191F9EE958"
    enctype="application/x-www-form-urlencoded">

<a id="form01:hyperlink01" href="#"
onclick="document.forms['form01']['form01:_idcl'].value='form01:hyperlink01';
document.forms['form01'].submit(); return false;">My
Link</a>
<a id="form01:hyperlink02" href="#"
onclick="document.forms['form01']['form01:_idcl'].value='form01:hyperlink02';
document.forms['form01'].submit(); return false;">This is a String property</a>
<a id="form01:hyperlink03" href="#"
onclick="document.forms['form01']['form01:_idcl'].value='form01:hyperlink03';
document.forms['form01'].submit(); return false;">RES-BUNDLE LINK</a>
<a id="form01:hyperlink04" href="#"
onclick="document.forms['form01']['form01:_idcl'].value='form01:hyperlink04';
document.forms['form01'].submit(); return false;"><img src="duke.gif" /></a>

  • <a id="form01:hyperlink05" href="#"
    onclick="document.forms['form01']['form01:_idcl'].value='form01:hyperlink05';
    document.forms['form01'].submit(); return false;"><img
    src="resbundle_image.gif;jsessionid=1F42887EA431E608414DB7159B9B67C8" alt="" /></a>
    + <a id="form01:hyperlink05" href="#"
    onclick="document.forms['form01']['form01:_idcl'].value='form01:hyperlink05';
    document.forms['form01'].submit(); return false;"><img
    src="resbundle_image.gif;jsessionid=71102211E1D9689C845183191F9EE958" alt="" /></a>
  • <a id="form01:hyperlink06" href="#"
    onclick="document.forms['form01']['form01:_idcl'].value='form01:hyperlink06';document.forms['form01']['param1'].value='value1';
    document.forms['form01'].submit(); return false;">Paramter Link</a>
  • <input type="hidden" name="form01" value="form01" /><input type="hidden"
    name="param1" /><input type="hidden" name="form01:_idcl" /></form>
    + <a id="form01:hyperlink06" href="#"
    onclick="document.forms['form01']['form01:_idcl'].value='form01:hyperlink06';document.forms['form01']['value1'].value='value1';
    document.forms['form01'].submit(); return false;">Paramter Link</a>
    + <input type="hidden" name="form01" value="form01" /><input type="hidden"
    name="value1" /><input type="hidden" name="form01:_idcl" /></form>
    </body>
    </html>

Index: RenderResponse_correct
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/web/test/RenderResponse_correct,v
retrieving revision 1.109
diff -u -r1.109 RenderResponse_correct
— RenderResponse_correct 28 Jul 2004 20:36:17 -0000 1.109
+++ RenderResponse_correct 2 Aug 2004 12:38:39 -0000
@@ -15,7 +15,7 @@

-<form id="basicForm" method="post"
action="/test/faces/TestRenderResponsePhase.jsp;jsessionid=6E6598E4B463B472E7F9A6A3054DD3DF"
class="formClass" accept-charset="some-charset" accept="html,wml"
enctype="application/x-www-form-urlencoded" title="basicForm">
+<form id="basicForm" method="post"
action="/test/faces/TestRenderResponsePhase.jsp;jsessionid=F24CE7A21FF23E25526AC4B8004D6097"
class="formClass" accept-charset="some-charset" accept="html,wml"
enctype="application/x-www-form-urlencoded" title="basicForm">

<TABLE BORDER="1">
@@ -130,12 +130,12 @@

  • <a id="basicForm:imageLink" href="#"
    style="someStyle"
    onclick="document.forms['basicForm']['basicForm:_idcl'].value='basicForm:imageLink';
    document.forms['basicForm'].submit(); return false;"><img
    src="duke.gif;jsessionid=6E6598E4B463B472E7F9A6A3054DD3DF" alt="" /></a>
    + <a id="basicForm:imageLink" href="#" style="someStyle"
    onclick="document.forms['basicForm']['basicForm:_idcl'].value='basicForm:imageLink';
    document.forms['basicForm'].submit(); return false;"><img
    src="duke.gif;jsessionid=F24CE7A21FF23E25526AC4B8004D6097" alt="" /></a>

</TD>

<TD>

  • <img id="basicForm:graphicImage"
    src="/test/duke.gif;jsessionid=6E6598E4B463B472E7F9A6A3054DD3DF"
    style="someStyle" usemap="#map1" ismap="ismap" alt="" />
    + <img id="basicForm:graphicImage"
    src="/test/duke.gif;jsessionid=F24CE7A21FF23E25526AC4B8004D6097"
    style="someStyle" usemap="#map1" ismap="ismap" alt="" />
    </TD>

</TR>
@@ -153,7 +153,7 @@

  • <a
    id="basicForm:commandParamLink" href="#"
    onclick="document.forms['basicForm']['basicForm:_idcl'].value='basicForm:commandParamLink';document.forms['basicForm']['name'].value='horwat';document.forms['basicForm']['value'].value='password';
    document.forms['basicForm'].submit(); return false;" class="hyperlinkClass">link
    text</a>
    + <a id="basicForm:commandParamLink" href="#"
    onclick="document.forms['basicForm']['basicForm:_idcl'].value='basicForm:commandParamLink';document.forms['basicForm']['horwat'].value='horwat';document.forms['basicForm']['password'].value='password';
    document.forms['basicForm'].submit(); return false;" class="hyperlinkClass">link
    text</a>
    </TD>
    </TR>

@@ -169,7 +169,7 @@

  • <a
    id="basicForm:hrefParamLink" href="#"
    onclick="document.forms['basicForm']['basicForm:_idcl'].value='basicForm:hrefParamLink';document.forms['basicForm']['name'].value='horwat';document.forms['basicForm']['value'].value='password';
    document.forms['basicForm'].submit(); return false;"><img
    src="duke.gif;jsessionid=6E6598E4B463B472E7F9A6A3054DD3DF" alt="" /></a>
    + <a id="basicForm:hrefParamLink" href="#"
    onclick="document.forms['basicForm']['basicForm:_idcl'].value='basicForm:hrefParamLink';document.forms['basicForm']['horwat'].value='horwat';document.forms['basicForm']['password'].value='password';
    document.forms['basicForm'].submit(); return false;"><img
    src="duke.gif;jsessionid=F24CE7A21FF23E25526AC4B8004D6097" alt="" /></a>
    </TD>
    </TR>

@@ -177,7 +177,7 @@

<TD>

  • <a id="basicForm:outputLink"
    href="test.html;jsessionid=6E6598E4B463B472E7F9A6A3054DD3DF"
    class="hyperlinkClass">output link text</a>
    + <a id="basicForm:outputLink"
    href="test.html;jsessionid=F24CE7A21FF23E25526AC4B8004D6097"
    class="hyperlinkClass">output link text</a>

</TD>

@@ -189,12 +189,12 @@

  • <a id="basicForm:output_imageLink"
    href="test.html;jsessionid=6E6598E4B463B472E7F9A6A3054DD3DF" style="position:
    absolute; left: 96px; top: 168px"><img
    src="duke.gif;jsessionid=6E6598E4B463B472E7F9A6A3054DD3DF" alt="" /></a>
    + <a id="basicForm:output_imageLink"
    href="test.html;jsessionid=F24CE7A21FF23E25526AC4B8004D6097" style="position:
    absolute; left: 96px; top: 168px"><img
    src="duke.gif;jsessionid=F24CE7A21FF23E25526AC4B8004D6097" alt="" /></a>

</TD>

<TD>

  • <img id="basicForm:output_graphicImage"
    src="/test/duke.gif;jsessionid=6E6598E4B463B472E7F9A6A3054DD3DF" usemap="#map1"
    ismap="ismap" alt="" />
    + <img id="basicForm:output_graphicImage"
    src="/test/duke.gif;jsessionid=F24CE7A21FF23E25526AC4B8004D6097" usemap="#map1"
    ismap="ismap" alt="" />
    </TD>

</TR>
@@ -202,7 +202,7 @@
<TR>
<TD>

  • <a id="basicForm:output_commandLink"
    href="test.html;jsessionid=6E6598E4B463B472E7F9A6A3054DD3DF" style="position:
    absolute; left: 96px; top: 168px" class="hyperlinkClass">link text</a>
    + <a id="basicForm:output_commandLink"
    href="test.html;jsessionid=F24CE7A21FF23E25526AC4B8004D6097" style="position:
    absolute; left: 96px; top: 168px" class="hyperlinkClass">link text</a>
    </TD>
    </TR>

@@ -212,13 +212,13 @@

  • <a
    id="basicForm:output_commandParamLink"
    href="test.html;jsessionid=6E6598E4B463B472E7F9A6A3054DD3DF?name=horwat&value=password"
    class="hyperlinkClass">link text</a>
    + <a id="basicForm:output_commandParamLink"
    href="test.html;jsessionid=F24CE7A21FF23E25526AC4B8004D6097?name=horwat&value=password"
    class="hyperlinkClass">link text</a>
    </TD>
    </TR>

<TR>
<TD>

  • <a id="basicForm:output_hrefLink"
    href="test.html;jsessionid=6E6598E4B463B472E7F9A6A3054DD3DF"><img
    src="duke.gif"></a>
    + <a id="basicForm:output_hrefLink"
    href="test.html;jsessionid=F24CE7A21FF23E25526AC4B8004D6097"><img
    src="duke.gif"></a>
    </TD>
    </TR>

@@ -228,7 +228,7 @@

  • <a
    id="basicForm:output_hrefParamLink"
    href="test.html;jsessionid=6E6598E4B463B472E7F9A6A3054DD3DF?name=horwat&value=password"><img
    src="duke.gif;jsessionid=6E6598E4B463B472E7F9A6A3054DD3DF" alt="" /></a>
    + <a id="basicForm:output_hrefParamLink"
    href="test.html;jsessionid=F24CE7A21FF23E25526AC4B8004D6097?name=horwat&value=password"><img
    src="duke.gif;jsessionid=F24CE7A21FF23E25526AC4B8004D6097" alt="" /></a>
    </TD>
    </TR>

@@ -846,7 +846,7 @@
<span id="basicForm:userMsg">Param 0: my param</span>

-<input type="hidden" name="basicForm" value="basicForm" /><input type="hidden"
name="value" /><input type="hidden" name="basicForm:_idcl" /><input
type="hidden" name="name" /></form>
+<input type="hidden" name="basicForm" value="basicForm" /><input type="hidden"
name="password" /><input type="hidden" name="horwat" /><input type="hidden"
name="basicForm:_idcl" /></form>

</BODY>


rogerk added a comment - 04/Aug/04 07:06 AM

The spec needs clarification changes with regards to
CommandLinkRenderer/FormRenderer responsibilities. The spec should outline in
more detail the steps that one would need to do for their own implementation.
The current implementation has tightly coupled FormRenderer/CommandLinkRenderer
dependencies (CommandLinkRenderer invokes static FormRenderer methods). The
spec should outline (in detail) another (less dependent) way of getting multiple
commandLinks in one or more forms to work. In addition, any "param" children
nested within a commandLink, must specify a parameter name - since this is
used as a hidden field name (this should also be more clear in the spec). The
change bundle (specified prior) is one possible solution - with one correction -
we should use param "name" (not "value") as the hiddden field name for
parameter children of commandLink(s).


rogerk added a comment - 06/Aug/04 05:52 AM

Additional comments from Adam:
Roger Kitain wrote:

> Hey Adam -
>
> Now that I've got your attention...
> If you get a chance look at issue 26 in java.net land (faces).
> We are trying to do away with this "hard coded" dependency between
> FormRenderer/CommandLinkRenderer - (essentially-find another way
> of accomplishing the same functionality but without having to
> use FormRenderer static method calls in CommandLinkRenderer.
> I thought of at least doing something like having the CommandLinkRenderer
> stuff some hidden field info into it's parent Form component attribute - so
the FormRenderer could use it when rendering the hidden fields.
>
> What do you think?

(Cc'ing the main dev list)

I see a few categories of potential solutions:

(1) Client-side Javascript solutions
(2) Break the dependency
(3) Keep the dependency, but make it a public API
(4) Dynamically add HtmlInputHidden components.

1. Client-side Javascript solutions
-----------------------------------
Instead of trying to create <input type="hidden"> fields
on the server, use DHTML to dynamically create DOM nodes
for these fields as needed. This is tricky for a bunch
of reasons (you'd want to rely on a helper script,
for one - who's responsible for writing this script?)
It's worth looking down this road later for other problems,
but for now, let's forget about it.

2. Break the dependency:
------------------------
Instead of relying on FormRenderer to output the hidden
fields, each CommandLink would output its hidden field
immediately, but only after checking that the hidden
field hadn't already been rendered by a different
CommandLink. Problems include:

  • How do you detect that you aren't in a different
    UIForm, and that the set of rendered hidden fields
    needs to be reset?
  • Even if you solve the "I'm in a different UIForm"
    case, you still have a dependency betwen
    CommandLinkRenderer and the Basic HTML RenderKit
    concept that "UIForms are what render HTML <form>s";
    this is a questionable assumption at best.
  • The moment you add a second component that needs
    to output hidden fields dynamically, you're back
    in the same boat with inter-renderer dependencies.

3. Keep the dependency, but make it a public API
------------------------------------------------
Expose a public contract: for example, assert that
a java.util.Set of needed names is added at a certain
key at request scope. This works, but has its own set of
problems:

  • We can't do so until 1.2 at the earliest, since this
    is a spec change.
  • Will this approach generalize going forward? Do we need
    a more generic solution at the component level? For
    example, future support for client-side validation may
    add dependencies between <h:inputText> and <h:form>; what
    APIs would be needed to generalize that dependency?

4. Dynamically add HtmlInputHidden components
---------------------------------------------
CommandLinkRenderer finds the UIForm and dynamically
creates and adds HtmlInputHidden components as needed
to render the needed hidden fields. Getting this
approach to work with the current JSF/JSP integration
seems hopeless.

Category #2 is the closest I can see to a tractable
approach to solving this issue in the 1.1 timeframe,
but my gut feeling is that it should be punted on for
1.1 altogether.

– Adam

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@javaserverfaces.dev.java.net
For additional commands, e-mail: dev-help@javaserverfaces.dev.java.net


rogerk added a comment - 26/Aug/04 12:29 PM

The spec side of this issue wil be handled here:

https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=12


jayashri added a comment - 13/Oct/04 03:00 PM

Issue targeted for JSF 1.2


Ed Burns added a comment - 27/Apr/05 02:38 PM

Take ownership.


Ed Burns added a comment - 27/Apr/05 02:40 PM

Created an attachment (id=57)
change-bundle


jayashri added a comment - 27/Apr/05 03:53 PM

I think casting to ServletResponse might pose a problem in the Portlet
Environment although I am not 100% sure about that. If its not too much of a
problem, can we introduce a getContentType() method on ExternalContext to be on
the safe side?
Thanks


Ed Burns added a comment - 29/Apr/05 11:21 AM

Created an attachment (id=58)
change-bundle


jayashri added a comment - 29/Apr/05 03:16 PM

CommandButton and CommandLink renderers use different ways to find its nearest
form element if interpreted the diffs correctly.

CommandButton
+ while (!myForm.getFamily().equals("javax.faces.Form") && root != myForm) { + myForm = myForm.getParent(); + }

commandLink
while (parent != null) {
if (parent instanceof UIForm) { break; }
parent = parent.getParent();
}

Shouldn't it be consistent ?

Otherwise looks great.
r=jayashri


Ed Burns added a comment - 02/May/05 05:50 AM

Fix checked in, including Jayashri's suggestion.


Ed Burns added a comment - 04/May/05 08:43 AM

While merging wta-head into jsf-head, I discovered another bug.

The HiddenRenderer needs to make sure that its values are cleared when the
"clear" script is executed. This leads to a contract between the HiddenRenderer
and the CommandLinkRenderer. We currently don't do this, creating a back buttor
problem:

— src/com/sun/faces/renderkit/html_basic/HiddenRenderer.java 2005-04-21
14:55:36.000000000 -0400
+++
/home/edburns/Projects/J2EE/workareas/webtier-alignment-trunk/prototype/jsf-ri/src/com/sun/faces/renderkit/html_basic/HiddenRenderer.java
2005-05-02 17:23:17.000000000 -0400
@@ -1,5 +1,5 @@
/*

  • * $Id: HiddenRenderer.java,v 1.23 2005/04/21 18:55:36 edburns Exp $
    + * $Id: HiddenRenderer.java,v 1.4 2005/03/31 16:39:17 edburns Exp $
    */

/*
@@ -89,6 +89,8 @@
writer.writeAttribute("value", currentValue, "value");
}
writer.endElement("input");
+
+ FormRenderer.addRenderedHiddenField(context, clientId);
}

// The testcase for this class is TestRenderers_3.java


Ed Burns added a comment - 31/May/05 10:24 AM

After talking to Jayashri, I realize that we don't need to clear out the values
from h:inputHidden fields in the page. These values should be submitted
regardless of any commandLinks in the page.

Closing.


Manfred Riem added a comment - 05/Jan/12 02:27 PM

Closing issue out