You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by udaykumar <ta...@gmail.com> on 2009/05/26 16:23:35 UTC
How to use 'extends' attribute of tag as well as
tag
Hi,
I'm using Struts 1.3.10 GA build.
I Know that we have feature called 'extends' attribute in <form-bean>,
<action> and also in <form> tag of validation.xml file.
I'm able to use extends attribute of <form> in validation.xml file .But now
the problem is i'm bit confused how to use the same attribute in <form-bean>
and <action> tag.
Here is the scenario....
I Have a form bean called LoginForm with two fields 'userName' and
'password'.
I would like to create another Form which contains the same two Fields along
with another field.
I created the form-bean configuration like this in my struts-config.xml file
<form-bean name="loginForm" type="com.LoginForm"/>
Now how can i use extends attribute .
I tried in this way
<form-bean name="myLogin" type="com.LoginActionForm" extends="loginForm"/>
When i deploy everything and checked it is giving the error like
No getter method for property: "userName" of bean: "com.LoginActionForm"
How to use the extends attribute.
Here are my two formbeans
1)public class LoginActionForm extends ValidatorActionForm {}
2)public class LoginForm extends ValidatorForm {
/**
*
*/
private static final long serialVersionUID = 1L;
private String userName;
private String password;
private static final Logger LOGGER = Logger.getLogger(LoginForm.class);
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public ActionErrors validate(ActionMapping mapping,HttpServletRequest
request)
{
ActionErrors errors=super.validate(mapping, request);
LOGGER.debug("In validate"+errors.size());
return errors;
}
}
Even if we extends the 'LoginActionForm' with 'ActionForm' also.. same error
is coming.
Help me in this.
--
View this message in context: http://www.nabble.com/How-to-use-%27extends%27-attribute-of-%3Cform-bean%3E-tag-as-well-as-%3Caction%3E-tag-tp23723801p23723801.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org