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
posted 12 years ago
Assuming you have already written an entity bean to insert data, follow these steps -
Use request.getParameter() to access form values in the Servlet.
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).