You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Gary VanMatre <gv...@comcast.net> on 2006/05/02 05:32:04 UTC
Re: [shale] Form token giving NPE
>Gary VanMatre wrote:
>>> From: Richard Wallace <rw...@thewallacepack.net>
>>>
>>> I'm trying to use the token component on a form to ensure that a user
>>> doesn't submit the form more than once. Whenever I try and submit the
>>> form a second time, I get a NPE. I'm using it in Clay, if that makes
>>> any difference. The code is simply:
>>>
>>> <form>
>>> <span jsfid="token" id="token" />
>>> <span jsfid="message" for="token" class="validation-msg" />
>>> ...
>>> </form>
>>>
>>>
>>> I'm using the 1.0.3-SNAPSHOT jars from the maven-snapshot-repository,
>>> last updated on April 19th. Any ideas why I'm getting the below NPE?
>>>
>>>
>>
>> It's working with myfaces 1.1.1. The exception points at the findComponent
>but I would have guessed that we are not populating one of the message component
>attributes.
>>
>> Try adding the showSummary attribute to the message component.
>> <span jsfid="message" for="token" showSummary="true" />
>> Gary
>>
>>
>Sorry it's taken a while to get back to this, but it was suddenly
>decided to change the whole flow of the app I'm working on.
>
>I tried adding the showSummary="true" attribute and am getting the same
>exception. Any other ideas?
>
It looks as if this HtmlMessageRenderer class is in the tomahawk archive.
It seems to be trying to find matching components for labels. Are you
sure you don't have a HtmlOutputLabel that has a null "for" attribute?
If you create a ticket and attach an example I'll try working throught it.
Gary
>Thanks,
>Rich
>>> Thanks,
>>> Rich
>>>
>>> java.lang.NullPointerException: expr
>>> at
>>> javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:210)
>>> at
>>>
>org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>> tmlMessageRenderer.java:200)
>>> at
>>>
>>>org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>> tmlMessageRenderer.java:214)
>>> at
>>>
>>org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>> tmlMessageRenderer.java:214)
>>> at
>>>
>>>org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>> tmlMessageRenderer.java:214)
>>> at
>>>
>>>org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>> tmlMessageRenderer.java:214)
>>> at
>>>
>>>org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>> tmlMessageRenderer.java:214)
>>> at
>>>
>>>org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>> tmlMessageRenderer.java:214)
>>> at
>>>
>>>org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>> tmlMessageRenderer.java:214)
>>> at
>>>
>>>org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.getOutputLabelMap(Html
>>> MessageRenderer.java:184)
>>> at
>>>
>>>org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.findInputLabel(HtmlMes
>>> sageRenderer.java:128)
>>> at
>>>
>>>org.apache.myfaces.renderkit.html.ext.HtmlMessagesRenderer.getSummary(HtmlMessag
>>> esRenderer.java:54)
>>> at
>>>
>>>org.apache.myfaces.renderkit.html.HtmlMessageRendererBase.renderSingleFacesMessa
>>> ge(HtmlMessageRendererBase.java:101)
>>> at
>>>
>>>org.apache.myfaces.renderkit.html.HtmlMessagesRendererBase.renderList(HtmlMessag
>>> esRendererBase.java:94)
>>> at
>>>
>>>org.apache.myfaces.renderkit.html.HtmlMessagesRendererBase.renderMessages(HtmlMe
>>> ssagesRendererBase.java:75)
>>> at
>>>
>>>org.apache.myfaces.renderkit.html.ext.HtmlMessagesRenderer.encodeEnd(HtmlMessage
>>> sRenderer.java:42)
>>> at
>>> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331)
>>> at
>>> org.apache.shale.clay.component.Clay.recursiveRenderChildren(Clay.java:379)
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
Re: [shale] Form token giving NPE
Posted by Richard Wallace <rw...@thewallacepack.net>.
Gary VanMatre wrote:
>> Gary VanMatre wrote:
>>
>>>> From: Richard Wallace <rw...@thewallacepack.net>
>>>>
>>>> I'm trying to use the token component on a form to ensure that a user
>>>> doesn't submit the form more than once. Whenever I try and submit the
>>>> form a second time, I get a NPE. I'm using it in Clay, if that makes
>>>> any difference. The code is simply:
>>>>
>>>> <form>
>>>> <span jsfid="token" id="token" />
>>>> <span jsfid="message" for="token" class="validation-msg" />
>>>> ...
>>>> </form>
>>>>
>>>>
>>>> I'm using the 1.0.3-SNAPSHOT jars from the maven-snapshot-repository,
>>>> last updated on April 19th. Any ideas why I'm getting the below NPE?
>>>>
>>>>
>>>>
>>> It's working with myfaces 1.1.1. The exception points at the findComponent
>>>
>> but I would have guessed that we are not populating one of the message component
>> attributes.
>>
>>> Try adding the showSummary attribute to the message component.
>>> <span jsfid="message" for="token" showSummary="true" />
>>> Gary
>>>
>>>
>>>
>> Sorry it's taken a while to get back to this, but it was suddenly
>> decided to change the whole flow of the app I'm working on.
>>
>> I tried adding the showSummary="true" attribute and am getting the same
>> exception. Any other ideas?
>>
>>
> It looks as if this HtmlMessageRenderer class is in the tomahawk archive.
> It seems to be trying to find matching components for labels. Are you
> sure you don't have a HtmlOutputLabel that has a null "for" attribute?
> If you create a ticket and attach an example I'll try working throught it.
>
> Gary
>
>
Yup, that was it exactly. The page in question is actually a "confirm
your input before continuing" type of page, so it doesn't have any
actual input components. But, it still uses a bunch of lines like
<label>Name</label>
<span class="t">#{@managed-bean-name.name}</span>
The only reason there is a label there is for getting the correct
styling (or so the web designer tells me). Clay turns these into
outputLabel components without a for attribute. So I changed the
t:messages component to just the plain old messages and it started
working perfectly. I don't particularly need it to be a t:messages
component, so that's not a big deal. I am noticing a bunch of warnings
about there being no for attribute in the logs. Should I add an id to
the <span> and set the for attribute to that, even though it's not an
input component? Or is that going to cause other problems you think?
Thanks for the help,
Rich
>
>> Thanks,
>> Rich
>>
>>>> Thanks,
>>>> Rich
>>>>
>>>> java.lang.NullPointerException: expr
>>>> at
>>>> javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:210)
>>>> at
>>>>
>>>>
>> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>
>>>> tmlMessageRenderer.java:200)
>>>> at
>>>>
>>>> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>>> tmlMessageRenderer.java:214)
>>>> at
>>>>
>>>>
>>> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>>
>>>> tmlMessageRenderer.java:214)
>>>> at
>>>>
>>>> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>>> tmlMessageRenderer.java:214)
>>>> at
>>>>
>>>> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>>> tmlMessageRenderer.java:214)
>>>> at
>>>>
>>>> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>>> tmlMessageRenderer.java:214)
>>>> at
>>>>
>>>> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>>> tmlMessageRenderer.java:214)
>>>> at
>>>>
>>>> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H
>>>> tmlMessageRenderer.java:214)
>>>> at
>>>>
>>>> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.getOutputLabelMap(Html
>>>> MessageRenderer.java:184)
>>>> at
>>>>
>>>> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.findInputLabel(HtmlMes
>>>> sageRenderer.java:128)
>>>> at
>>>>
>>>> org.apache.myfaces.renderkit.html.ext.HtmlMessagesRenderer.getSummary(HtmlMessag
>>>> esRenderer.java:54)
>>>> at
>>>>
>>>> org.apache.myfaces.renderkit.html.HtmlMessageRendererBase.renderSingleFacesMessa
>>>> ge(HtmlMessageRendererBase.java:101)
>>>> at
>>>>
>>>> org.apache.myfaces.renderkit.html.HtmlMessagesRendererBase.renderList(HtmlMessag
>>>> esRendererBase.java:94)
>>>> at
>>>>
>>>> org.apache.myfaces.renderkit.html.HtmlMessagesRendererBase.renderMessages(HtmlMe
>>>> ssagesRendererBase.java:75)
>>>> at
>>>>
>>>> org.apache.myfaces.renderkit.html.ext.HtmlMessagesRenderer.encodeEnd(HtmlMessage
>>>> sRenderer.java:42)
>>>> at
>>>> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331)
>>>> at
>>>> org.apache.shale.clay.component.Clay.recursiveRenderChildren(Clay.java:379)
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org