THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
package sampleear; import java.io.IOException; import javax.ejb.EJB; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class MyServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet { static final long serialVersionUID = 1L; @EJB RemoteBusinessInterface remoteBusinessIntf; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("name"); if (name == null || name.length() == 0) { name = "anonymous"; } response.getWriter().write(remoteBusinessIntf.sayHello(name)); } } |
Run it!
After a very hard 4-minute development All it's time to give it a shot and see if it works. Not much time left so hurry up!left before we test this sample it to deploy it. This task is done automatically for you when you choose to run the application directly from the eclipse workspace.
- Right-click on the SampleEAR project and select Run As -> Run on Server. When Run On Server popup window comes up, select the Always use this server when running this project checkbox. Leave the rest as is.
...
...
- Click Finish.
- The server's stopped so nothing happens (from a user's perspective at least). Open up the Servers tab and right-click on Apache Geronimo v2.
...
- 1 Server at localhost and select Start.
...
- After a few seconds, Geronimo
...
- will be up and running with the enterprise application published. Open up the browser of your choice and go to http://localhost:8080/SampleWAR.
Type in any name you want, e.g. Jacek and press Press me! button.
...