*
The moose likes EJB and other Java EE Technologies and the fly likes Form values retreive in servlet and passed to EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Form values retreive in servlet and passed to EJB" Watch "Form values retreive in servlet and passed to EJB" New topic
Author

Form values retreive in servlet and passed to EJB

saahil sinha
Ranch Hand

Joined: Apr 07, 2003
Posts: 68
Can someone please tell me how do i pass the form values retrieved in a servlet to an ejb where the form values will be inserted in a databse.
I need an example code for this.
Also i need to know a good applicaion server to use for J2EE which does not require much of study and can be used quickly.I tried using JBoss but i just canot download the server from the site.
The requirement is urgent so pls help
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Assuming you have already written an entity bean to insert data, follow these steps -
  • Use request.getParameter() to access form values in the Servlet.
  • Using InitialContext, lookup home stub for your ejb.
  • Call home.create() which will then call ejbCreate() on your bean.


  • Note that this is just one of many possible approaches. You can use straight JDBC calls instead of entity beans. Similarly you can encapsulate calls to entity bean(s) in a session bean and call session bean methods from the web-tier(Servlet).
    For code examples, just google around for EJB resources and you will find plenty of them.
    App servers come in all shapes and sizes. Sun's J2EE reference implementation is the simplest of all, but has no "smart" capabilities. JBoss, BEA WebLogic and IBM WebSphere are some of the popular ones. Regardless of which one you use, you will have to spend some time understanding the deployment procedures specific to the product.
    Cheers,


    Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
     
     
    subject: Form values retreive in servlet and passed to EJB
     
    Similar Threads
    how to get selected check box values in struts?
    EJB deployment in jboss
    problems with forms + multipart/form + servlets
    which java technology to use??
    Using servlet save the form values into the database.