Hi,
You can use struts nested tags to retrieve the beans stored in the
action form.
Code snippet is as follows
      <nested:root name="MyForm" >
      <nested:nest property="MyBean" >
      <nested:write property="firstName"/>
      </nested:nest property="MyBean" >
      </nested:root name="MyForm" >
Thanks,
Satish





-----Original Message-----
From: Jannu Winod [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 08, 2004 9:40 AM
To: Struts Users Mailing List
Subject: 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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to