You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jannu Winod <wi...@yahoo.com> on 2004/06/08 06:10:25 UTC
user defined beans in form bean
how to handle user defined beans if we are using them in form beans. see the following code. Im looking for the jsp code in struts to define the text fields
pls send me the code.
with thnx.
class MyBean
{
private String firstName;
private String lastName;
public void setFirstName(String strFirstName){
this.firstName=strFirstName;
}
public String getFirstName(){
return this.firstName;
}
public void setLastName(String strLastName){
this.lastName=strLastName;
}
public String getLastName(){
return this.lastName;
}
}
FormBean :
public class MyForm extends ActionForm
{
private MyBean mybean;
private String ssno;
public void setMybean(MyBean mybean){
this.mybean=mybean;
}
public MyBean getMybean(){
return this.mybean;
}
public void setSsno(String ssno){
this.ssno=ssno;
}
public String getSsno(){
return this.ssno;
}
}
JSP:
First Name : <input type="text" name="txtFirstName">
Last Name : <input type="text" name="txtLastName">
SSNo : <input type="text" name="txtSSNo">
---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger
Re: user defined beans in form bean
Posted by Bill Siggelkow <bi...@bellsouth.net>.
<html:text property="myBean.firstName"/>
<html:text property="myBean.lastName"/>
...
Jannu Winod wrote:
> how to handle user defined beans if we are using them in form beans. see the following code. Im looking for the jsp code in struts to define the text fields
>
> pls send me the code.
>
> with thnx.
>
> class MyBean
> {
> private String firstName;
> private String lastName;
>
> public void setFirstName(String strFirstName){
> this.firstName=strFirstName;
> }
> public String getFirstName(){
> return this.firstName;
> }
>
> public void setLastName(String strLastName){
> this.lastName=strLastName;
> }
> public String getLastName(){
> return this.lastName;
> }
> }
>
> FormBean :
>
> public class MyForm extends ActionForm
> {
> private MyBean mybean;
> private String ssno;
>
> public void setMybean(MyBean mybean){
> this.mybean=mybean;
> }
> public MyBean getMybean(){
> return this.mybean;
> }
> public void setSsno(String ssno){
> this.ssno=ssno;
> }
> public String getSsno(){
> return this.ssno;
> }
> }
>
>
>
> JSP:
>
> First Name : <input type="text" name="txtFirstName">
> Last Name : <input type="text" name="txtLastName">
> SSNo : <input type="text" name="txtSSNo">
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Friends. Fun. Try the all-new Yahoo! Messenger
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org