Results 1 to 2 of 2
  1. #1
    ashokkumar is offline Member
    Join Date
    Oct 2008
    Posts
    1
    Rep Power
    0

    Default Creating Java bean From XML File in WebApplication

    Hi
    I am getting follwoing XML file by browsing in my jsp page,then i want to create java bean class by clicking one "convertBEAN" button in my JSP page.Using JAXB,XMLBean etc i am able to create the java bean.

    But my problem is how to add this thing in Web application(JSP file) so that it will dynamically generate the bean class.

    If any one have already done this thing please help me.


    <employee>
    <name>Ashok</name>
    <dept>Acct</dept>
    <address>
    <city>xyz</city>
    <zip>560037</zip>
    </address>
    </employee>

    After Clicking "ConvertButton", Converted bean class should be

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

    public Employee(){}

    public String getName()
    {
    return name;
    }

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

    public String getDept()
    {
    return dept;
    }
    public setDept(String dept)
    {
    this.dept = dept;
    }

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


    class Address
    {
    private String city;
    private int zip;

    public Address(){}

    public String getCity()
    {
    return city;
    }
    public setCity(String city)
    {
    this.city = city;
    }

    public int getZip()
    {
    return zip;
    }

    public setZip(int zip)
    {
    this.zip= zip;
    }
    }


    Thanks
    Ashok.

  2. #2
    georgemc is offline Senior Member
    Join Date
    Sep 2008
    Posts
    135
    Rep Power
    0

    Default

    Why do you need to do that? How do you plan on having your application use types it knows absolutely nothing about until runtime? What are you actually trying to do?

Similar Threads

  1. how to import a ejb bean in java file
    By vijayinani in forum Enterprise JavaBeans (EJB)
    Replies: 2
    Last Post: 06-30-2009, 10:05 PM
  2. Replies: 1
    Last Post: 01-29-2009, 09:35 AM
  3. Replies: 1
    Last Post: 01-29-2009, 09:33 AM
  4. Creating Folder in JAVA and Copying File
    By fnoman in forum New To Java
    Replies: 8
    Last Post: 10-18-2008, 07:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •