myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Myfaces Wiki] Update of "forceId" by Jan Dockx
Date Mon, 19 Sep 2005 07:56:46 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by Jan Dockx:
http://wiki.apache.org/myfaces/forceId

------------------------------------------------------------------------------
  Sometimes, developers want to read HTTP request parameters directly in their code. They
would be the result of a HTTP POST, from a page generated by JSF. The parameter the developer
is interested in would probably be generated by a {{{<h:inputHidden ...}}} or another input
field.
  
- The problem these developers are confronted with is that the actual name in the HTTP POST
of the HTTP request parameter they are interested in, is difficult to control. The rendered
input field has an {{{id}}} and {{{name}}} that is often generated, or at least modified,
by JSF. JSF components use ''naming contexts'' to make them unique in a page. Suppose the
input field with id {{{myRequestParamName}} is used in a form, with id {{{myForm}}}, which
is used inside a panel group with id {{{scope1}}}, which is used inside an {{{t:div}}} with
id {{{scope0}}}, etc.
+ The problem these developers are confronted with is that the actual name in the HTTP POST
of the HTTP request parameter they are interested in, is difficult to control. The rendered
input field has an {{{id}}} and {{{name}}} that is often generated, or at least modified,
by JSF. JSF components use ''naming contexts'' to make them unique in a page. Suppose the
input field with id {{{myRequestParamName}}} is used in a form, with id {{{myForm}}}, which
is used inside a panel group with id {{{scope1}}}, which is used inside an {{{t:div}}} with
id {{{scope0}}}, etc.
  {{{
    ...
    <t:div id="scope0" ... >
@@ -11, +11 @@

        ...
        <h:form id="myForm" ...>
          ...
-         <t:inputHidden id="myRequestParamName" forceId="true"  ... />
+         <t:inputHidden id="myRequestParamName"  ... />
          ...
        </h:form>
        ...
@@ -42, +42 @@

    </t:div>
    ...
  }}}
- will result in a HTML hidden input tage in the generated page with id and name {{{myRequestParamName}}}
+ will result in a HTML hidden input tage in the generated page with id and name {{{myRequestParamName}}}.
  
  Obviously, the burden then falls on your shoulders to make sure that the id is unique in
the page, also considering included files or tiles.
  

Mime
View raw message