Thanks.
On 11/6/06, William Huang <[EMAIL PROTECTED]> wrote:
your User object is null and call getUser(). You need to create new User
object before the getUser() gets call.
"Mick Knutson"
<[EMAIL PROTECTED]
l.com> To
"MyFaces Discussion"
11/03/2006 01:48 < [email protected]>
PM cc
Subject
Please respond to BackingBean with POJO for model
"MyFaces
Discussion"
<[EMAIL PROTECTED]
ache.org>
I was creating a BackingBean that has my hibernate POJO inside like:
UserBackingBean:
===========================================
public class UserBackingBean extends BaseObject {
private User user;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
} // The End...
User.java:
=============================
public class User extends BaseObject {
private static final long serialVersionUID = -5450022397980854742L;
private java.lang.String username;
private java.lang.String password;
private java.lang.String passwordConfirm;
private java.lang.String firstName;
private java.lang.String email;
private java.lang.String lastName;
private java.lang.String address;
private java.lang.String address2;
private java.lang.String city;
private java.lang.String state;
private java.lang.String otherState;
private java.lang.String postalCode;
private java.lang.String country;
private java.util.Date lastUpdate;
private java.util.Date creationDate;
public String getUsername() {
return username;
}
...... more omitted....
Registration.jsp :
===================================
<h:form>
<TABLE>
<TBODY>
<TR>
<TD>
<h:outputText value="#{messages['
label.firstName']}" />:
</TD>
<TD>
<h:inputText
value="#{UserBackingBean.user.firstName}"
required="true"
id="user.firstName" >
<f:validateLength minimum="2" />
</h:inputText>
<h:message for="" user.firstName"
errorClass="error" />
</TD>
</TR>
When I use the "id="user.firstName"" in the input text I get:
10:37:30,445 ERROR [[jsp]] Servlet.service() for servlet jsp threw
exception
java.lang.IllegalArgumentException: Subsequent characters of component
identifier must be a letter, a digit, an underscore ('_'), or a dash ('-')!
But comp
onent identifier contains "."
But when I use
<h:inputText
value="#{UserBackingBean.user.lastName}"
required="true"
id="lastName" >
<f:attribute name="lastName"
value="#{messages['error.required']}" />
</h:inputText>
<h:message for=""> errorClass="error" />
Then I just submit the form with nothing in the text field, I get this:
"lastName": Error during model data update.
in the messages.
Why do I not get a "Required" error message?
--
Thanks
DJ MICK
http://www.djmick.com
http://www.myspace.com/mickknutson
Disclaimer: This electronic mail and any attachments are confidential and may be privileged. If you are not the intended recipient, please notify the sender immediately by replying to this email, and destroy all copies of this email and any attachments. Thank you.
--
Thanks
DJ MICK
http://www.djmick.com
http://www.myspace.com/mickknutson

