facebook

How do I create/deploy a simple java bean

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #203121 Reply

    Mike
    Member

    My Environment is as follows:

    – Redhat 8
    – Eclipse Platform Version: 2.1.1, Build id: 200306271545. This was
    a fresh install for MyEclipse and there are no other plugins
    installed. – MyEclipse Workbench 2.7 rc2.
    – j2sdk1.4.2-03
    – I have both Tomcat 4.1.29 and Tomcat 5.0.18 installed.

    I am trying to create a simple servlet that requires the use of a java bean. I create the webapp servlet using File/New/Other/j2ee/web/applet
    that looks like this ….

    package com.time;

    import com.time.beans.Charge;

    …snip….

    public class TimeServlet extends HttpServlet {

    public void init() {

    log(“init was called”);

    }

    public void doGet(HttpServletRequest request,

    HttpServletResponse response) throws ServletException,

    IOException {

    ….. snip ……
    Charge c = new Charge();

    c.setName(name);

    c.setProject(project);

    c.setHours(hours);

    c.setDate(date);

    and I want to create and deploy a java bean that looks like ….

    package com.time.beans;

    public class Charge implements java.io.Serializable {

    private String name;

    private String project;

    private String hours;

    private String date;

    public Charge() {}

    public String getName() {

    return name;

    }

    …. snip …..

    What menus / how do I create the Java bean and make sure that the servlet can see it ? I don’t want to use EJB’s just a simple java bean to track data

    #203179 Reply

    Scott Anderson
    Participant

    File > New > Class would do the trick. A javabean is nothing more than a class with get/set methods and a default constructor, after all.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: How do I create/deploy a simple java bean

You must be logged in to post in the forum log in