Skip to main content

form prependId=false not working

6 replies [Last post]
jweight
Offline
Joined: 2007-11-12
Points: 0

I have this form in a composite component

:
:

I would expect the various input IDs not to have the form's id prepended to them. This is the form that I get in my web browser.

Username:
Password:

Notice the incorrect ids for all controls in the form. Am I using prependId incorrectly, or is it broken?

Thanks,
Joel

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Ryan Lubke

On 4/5/10 4:28 PM, Joel Weight wrote:
> Sorry, forgot to mention, JSF 2.0.2-b10 on Glassfish V3.
>
> On Mon, Apr 5, 2010 at 5:27 PM, > > wrote:
>
> I have this form in a composite component
>
>
> : > id="j_username" value="#{cc.attrs.beanUser.username}"/>

> : > id="j_password" value="#{cc.attrs.beanUser.password}"/>
> > value="#{cc.attrs.labelLogin}" action="#{cc.attrs.action}" />
>

>
> I would expect the various input IDs not to have the form's id
> prepended to them. This is the form that I get in my web browser.
>
>

> action="/comp/faces/test/login/testLogin.xhtml"
> enctype="application/x-www-form-urlencoded">
>
> > value="j_idt9:loginForm" />
> Username: > name="j_idt9:j_username" />
> Password: > name="j_idt9:j_password" value="" />
> > value="Submit" />
> > id="javax.faces.ViewState"
> value="3823458531816362878:8106158547383944399" autocomplete="off" />
>

>
> Notice the incorrect ids for all controls in the form. Am I using
> prependId incorrectly, or is it broken?
>
The IDs are as they should be. One thing to keep in mind is that *all*
composite components are NamingContainers which means all components
within the composite component will inherit its ID. Setting prependId
on the form has no bearing here (and no, there is no way to disable the
ID behavior on composite components as you can with the form).

>
> Thanks,
> Joel
> [Message sent by forum member 'jweight']
>
> http://forums.java.net/jive/thread.jspa?messageID=395392
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
>
> For additional commands, e-mail:
> webtier-help@glassfish.dev.java.net
>
>
>

[att1.html]

jdlee
Offline
Joined: 2006-01-25
Points: 0

To clarify Ryan's comment a bit, perhaps, what you are seeing is the ID of the composite component itself, which is a NamingContainer, being applied to all of the child components. Since the form has prependId set to false, it is not prepended, but the parent NamingContainer's is, thus you get ""j_idt9:j_password". If you give your composite component usage an ID on the using page, you'll see j_idt9 changed to the explicit ID you add.

Joel Weight

Sorry, forgot to mention, JSF 2.0.2-b10 on Glassfish V3.

On Mon, Apr 5, 2010 at 5:27 PM, wrote:

> I have this form in a composite component
>
>
> : > id="j_username" value="#{cc.attrs.beanUser.username}"/>

> : > id="j_password" value="#{cc.attrs.beanUser.password}"/>
> > value="#{cc.attrs.labelLogin}" action="#{cc.attrs.action}" />
>

>
> I would expect the various input IDs not to have the form's id prepended to
> them. This is the form that I get in my web browser.
>
>

> action="/comp/faces/test/login/testLogin.xhtml"
> enctype="application/x-www-form-urlencoded">
>
>
> Username: > name="j_idt9:j_username" />
> Password: > name="j_idt9:j_password" value="" />
> > value="Submit" />
> > id="javax.faces.ViewState" value="3823458531816362878:8106158547383944399"
> autocomplete="off" />
>

>
> Notice the incorrect ids for all controls in the form. Am I using
> prependId incorrectly, or is it broken?
>
> Thanks,
> Joel
> [Message sent by forum member 'jweight']
>
> http://forums.java.net/jive/thread.jspa?messageID=395392
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>
>
[att1.html]

Joel Weight

I know I'm talking to myself, but for anyone else that comes upon this
issue, if I take the form and controls out of a composite component and put
it directly in the page, it works as expected. I suspect can
quasi-componentize it using using ui:include instead of a full on composite
component if i have to.

If this is a bug, let me know and I'll log it. If not, I would appreciate a
link to documentation explaining why.

Thanks,
Joel

On Mon, Apr 5, 2010 at 5:28 PM, Joel Weight wrote:

> Sorry, forgot to mention, JSF 2.0.2-b10 on Glassfish V3.
>
>
> On Mon, Apr 5, 2010 at 5:27 PM, wrote:
>
>> I have this form in a composite component
>>
>>
>> : >> id="j_username" value="#{cc.attrs.beanUser.username}"/>

>> : >> id="j_password" value="#{cc.attrs.beanUser.password}"/>
>> >> value="#{cc.attrs.labelLogin}" action="#{cc.attrs.action}" />
>>

>>
>> I would expect the various input IDs not to have the form's id prepended
>> to them. This is the form that I get in my web browser.
>>
>>

>> action="/comp/faces/test/login/testLogin.xhtml"
>> enctype="application/x-www-form-urlencoded">
>>
>> >> />
>> Username: >> name="j_idt9:j_username" />
>> Password: >> name="j_idt9:j_password" value="" />
>> >> value="Submit" />
>> >> id="javax.faces.ViewState" value="3823458531816362878:8106158547383944399"
>> autocomplete="off" />
>>

>>
>> Notice the incorrect ids for all controls in the form. Am I using
>> prependId incorrectly, or is it broken?
>>
>> Thanks,
>> Joel
>> [Message sent by forum member 'jweight']
>>
>> http://forums.java.net/jive/thread.jspa?messageID=395392
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
>> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>>
>>
>
[att1.html]

Ryan Lubke

On 4/6/10 9:45 AM, Joel Weight wrote:
> I know I'm talking to myself, but for anyone else that comes upon this
> issue, if I take the form and controls out of a composite component
> and put it directly in the page, it works as expected.
You're not talking to yourself. Please see my previous response.
> I suspect can quasi-componentize it using using ui:include instead of
> a full on composite component if i have to.
>
> If this is a bug, let me know and I'll log it. If not, I would
> appreciate a link to documentation explaining why.
>
> Thanks,
> Joel
>
> On Mon, Apr 5, 2010 at 5:28 PM, Joel Weight > > wrote:
>
> Sorry, forgot to mention, JSF 2.0.2-b10 on Glassfish V3.
>
>
> On Mon, Apr 5, 2010 at 5:27 PM, > > wrote:
>
> I have this form in a composite component
>
>
> :
> > value="#{cc.attrs.beanUser.username}"/>

> :
> > value="#{cc.attrs.beanUser.password}"/>
> > value="#{cc.attrs.labelLogin}" action="#{cc.attrs.action}" />
>

>
> I would expect the various input IDs not to have the form's id
> prepended to them. This is the form that I get in my web browser.
>
>

> method="post" action="/comp/faces/test/login/testLogin.xhtml"
> enctype="application/x-www-form-urlencoded">
>
> > value="j_idt9:loginForm" />
> Username: > name="j_idt9:j_username" />
> Password: > type="password" name="j_idt9:j_password" value="" />
> > value="Submit" />
> > id="javax.faces.ViewState"
> value="3823458531816362878:8106158547383944399"
> autocomplete="off" />
>

>
> Notice the incorrect ids for all controls in the form. Am I
> using prependId incorrectly, or is it broken?
>
> Thanks,
> Joel
> [Message sent by forum member 'jweight']
>
> http://forums.java.net/jive/thread.jspa?messageID=395392
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> webtier-unsubscribe@glassfish.dev.java.net
>
> For additional commands, e-mail:
> webtier-help@glassfish.dev.java.net
>
>
>
>

[att1.html]

Joel Weight

Thanks for the response Ryan. I hadn't received your response yet when I
replied to myself this morning. Your clarification is perfect.

Thanks again,
Joel

On Tue, Apr 6, 2010 at 10:48 AM, Ryan Lubke wrote:

> On 4/6/10 9:45 AM, Joel Weight wrote:
>
> I know I'm talking to myself, but for anyone else that comes upon this
> issue, if I take the form and controls out of a composite component and put
> it directly in the page, it works as expected.
>
> You're not talking to yourself. Please see my previous response.
>
> I suspect can quasi-componentize it using using ui:include instead of a
> full on composite component if i have to.
>
> If this is a bug, let me know and I'll log it. If not, I would
> appreciate a link to documentation explaining why.
>
> Thanks,
> Joel
>
> On Mon, Apr 5, 2010 at 5:28 PM, Joel Weight wrote:
>
>> Sorry, forgot to mention, JSF 2.0.2-b10 on Glassfish V3.
>>
>>
>> On Mon, Apr 5, 2010 at 5:27 PM, wrote:
>>
>>> I have this form in a composite component
>>>
>>>
>>> : >>> id="j_username" value="#{cc.attrs.beanUser.username}"/>

>>> : >>> id="j_password" value="#{cc.attrs.beanUser.password}"/>
>>> >>> value="#{cc.attrs.labelLogin}" action="#{cc.attrs.action}" />
>>>

>>>
>>> I would expect the various input IDs not to have the form's id prepended
>>> to them. This is the form that I get in my web browser.
>>>
>>>

>>> action="/comp/faces/test/login/testLogin.xhtml"
>>> enctype="application/x-www-form-urlencoded">
>>>
>>> >>> />
>>> Username: >>> name="j_idt9:j_username" />
>>> Password: >>> name="j_idt9:j_password" value="" />
>>> >>> value="Submit" />
>>> >>> id="javax.faces.ViewState" value="3823458531816362878:8106158547383944399"
>>> autocomplete="off" />
>>>

>>>
>>> Notice the incorrect ids for all controls in the form. Am I using
>>> prependId incorrectly, or is it broken?
>>>
>>> Thanks,
>>> Joel
>>> [Message sent by forum member 'jweight']
>>>
>>> http://forums.java.net/jive/thread.jspa?messageID=395392
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
>>> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>>>
>>>
>>
>
>
[att1.html]