You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by gr...@intellicare.com on 2005/10/13 22:51:22 UTC

[Shale] Changing String type to HtmlInputText in Backingbean gives No Propertyeditor error

I *finally* had time to download and build Shale from source and I did 
notice that error(UICompnenet, String) is indeed fixed (thank you again, 
Ronald Holshausen:)).. So anyway i decided to make parallel changes to 
another of my backing bean's attributes.

So my jsp has this:
<h:inputText id="userName" required="true"
                                value="#{registration.userName}" />
..
<h:inputSecret id="password" required="true"
                                binding="#{registration.password}" />

My backingbean RegistrationBean has the following:

private HtmlInputText userName = null;
private HtmlInputSecret password = null;
with appropriate getters and setters.

However when i try to show that jsp, I get the foll. error:
javax.faces.el.EvaluationException: Cannot set value for expression 
'#{registration.userName}' to a new value of type java.lang.String
...
Caused by: javax.servlet.jsp.el.ELException: Attempt to convert String 
"Geeta" to type "javax.faces.component.html.HtmlInputText", but there is 
no PropertyEditor for that type

I suppose I can convince myself why this is a problem - and sure enough if 
I change userName to be a String instead everything is hunky-dory.. But 
here's my question. If I change userName a String userName,  **but keep 
password still as HtmlInputSecret**, things still work.  My thought is 
that my app should gag with password being of type HtmlInputSecret too and 
ought to demand that it be of type String too..? What is the explanation 
for this seeming discripency? And more importantly, what should I do to 
fix the code so that i can declare userName as HtmlInputText?

Thanks in advance for your help,
Geeta

Re: [Shale] Changing String type to HtmlInputText in Backingbean gives No Propertyeditor error

Posted by gr...@intellicare.com.
Rahul Akolkar <ra...@gmail.com> wrote on 10/13/2005 07:40:06 PM:
> 
> I was tempted to change the prefix to JSF, but didn't want to break
> the email thread.

Much to my surprise I actually know why you say this - my "progress" with 
JSf/Shale has been so halting that most times i don't know if I am looking 
at a Shale issue or a JSF issue (:( However, read on...

> 
> The above suggestion should do it. But I'd ask why you want to bind
> component instances rather than values? If this is a "traditional"
> login view, I'd think binding values should be sufficient?

You are quite right. The only reason I did this was (following a 
suggestion of Craig's) to use Shale's 
AbstractFacesBean.error(UIComponent,String) method. If I bound component 
instances, then the code for getting at the UIComponent is simpler. 

> 
> -Rahul
> 

Thanks for your input!
Geeta

Re: [Shale] Changing String type to HtmlInputText in Backingbean gives No Propertyeditor error

Posted by Rahul Akolkar <ra...@gmail.com>.
On 10/13/05, Wendy Smoak <ja...@wendysmoak.com> wrote:
> From: <gr...@intellicare.com>
>
> > So my jsp has this:
> > <h:inputText id="userName" required="true"
> >                                value="#{registration.userName}" />
> > ..
> > <h:inputSecret id="password" required="true"
> >                                binding="#{registration.password}" />
> >
> > My backingbean RegistrationBean has the following:
> >
> > private HtmlInputText userName = null;
> > private HtmlInputSecret password = null;
> > with appropriate getters and setters.
>
> What happens if you use 'binding' instead of 'value' for the userName?
>
> <h:inputText id="userName" required="true"
>                               binding="#{registration.userName}" />
<snip/>

I was tempted to change the prefix to JSF, but didn't want to break
the email thread.

The above suggestion should do it. But I'd ask why you want to bind
component instances rather than values? If this is a "traditional"
login view, I'd think binding values should be sufficient?

-Rahul

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [Shale] Changing String type to HtmlInputText in Backingbean gives No Propertyeditor error

Posted by gr...@intellicare.com.
Wendy Smoak <ja...@wendysmoak.com> wrote on 10/13/2005 05:57:58 PM:

> From: <gr...@intellicare.com>
> 
> > So my jsp has this:
> > <h:inputText id="userName" required="true"
> >                                value="#{registration.userName}" />
> > ..
> > <h:inputSecret id="password" required="true"
> >                                binding="#{registration.password}" />
> > 
> > My backingbean RegistrationBean has the following:
> > 
> > private HtmlInputText userName = null;
> > private HtmlInputSecret password = null;
> > with appropriate getters and setters.
> 
> What happens if you use 'binding' instead of 'value' for the userName?
> 
> <h:inputText id="userName" required="true"
>                                binding="#{registration.userName}" />

omg, do I feel stupid. That's certainly the problem. Sorry for wasting 
your time.. and thank you!

> 
> -- 
> Wendy
> 

Geeta

Re: [Shale] Changing String type to HtmlInputText in Backingbean gives No Propertyeditor error

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: <gr...@intellicare.com>

> So my jsp has this:
> <h:inputText id="userName" required="true"
>                                value="#{registration.userName}" />
> ..
> <h:inputSecret id="password" required="true"
>                                binding="#{registration.password}" />
> 
> My backingbean RegistrationBean has the following:
> 
> private HtmlInputText userName = null;
> private HtmlInputSecret password = null;
> with appropriate getters and setters.

What happens if you use 'binding' instead of 'value' for the userName?

<h:inputText id="userName" required="true"
                               binding="#{registration.userName}" />

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org