Actually you probably won't find many tutorials on this. Someone will
correct me if I'm wrong but all a bean is is basically a java class
with set and get methods. The neat thing about using the set and get
methods in a j2ee world is that there are ways that the application
can just call these set and get methods without you really having to
manually make the calls. So a simple bean might be...

public class Employee {
  private String name;
  private String address;

  public void setName( String name ) {
    this.name = name;
  }
  public String getName() {
    return name;
  }

  public void setAddress( String address ) {
    this.address = address;
  }
  public String getAddress() {
    return address;
  }
}

The neat thing about Struts (and I'm totally new to using Struts so
pardon if I state this wrong) is that if you submit a JSP form to an
Action class that uses a form bean like above it will automatically
populate the fields for you ( In other words you don't have to
actually do employee.setName( request.getParameter("name") );, all
that is done for you ). Really cool. There are other things about
beans also like they are usually made serializable, etc., but the
basic thing to know is that a bean is an object with set and get
methods.



On Thursday, March 28, 2002, 11:48:39 AM, Tarek wrote:

TMN> I'll try to post this maybe too simple question again.

TMN> -----Original Message-----
TMN> From: Tarek M. Nabil 
TMN> Sent: Tuesday, March 26, 2002 3:41 PM
TMN> To: Struts (E-mail)
TMN> Subject: Beans Tutorial


TMN> Hi everyone,

TMN> I'm new to Struts, and the first thing I learned was that Struts uses a lot of 
Java beans :)

TMN> I've done some server side Java development before, but I usually went for the 
spaghetti code method and when I needed to encapsualte any functionality outside of 
the JSP, I usually used normal
TMN> Java classes. Now, that I want to improve my methods, and think Struts is a very 
good way to do it, I need to learn about Java beans. I checked the Java tutorial, but 
it seems that it is very
TMN> much focused on beans as gui components. I'm not interested in this and I need a 
beans tutorial that is more inclined towards server side development. Can anyone guide 
me to such a tutorial?

TMN> Thanks in advance for your help :)

TMN> Tarek M. Nabil
TMN> Software Engineer
TMN> ITWorx
TMN> [EMAIL PROTECTED]
TMN> Free Zone, Area 7 (B),
TMN> Block (J), Nasr City,
TMN> Cairo, Egypt
TMN> TEL.: 20-2-2766226
TMN> http://www.itworx.com
 

TMN> --
TMN> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
TMN> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



-- 

Rick
mailto:[EMAIL PROTECTED]

"Perhaps, if I am very lucky, the feeble efforts of my lifetime will
someday be noticed, and maybe, in some small way, they will be
acknowledged as the greatest works of genius ever created by Man." 
  -Jack Handey


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

Reply via email to