Objective
To show a simple JEE6 HelloWorld Servlet development
Environment
- Eclipse Juno
- JBoss EAP 6.0 Application Server
- Java 7
Development
1.
Start Eclipse.
2.
Configuring Server
b.
Select button Add, this will open a new window
c.
Select Server “JBoss Enterprise Application
Platform 6.0 Runtime”.
In case the server is not listed please download the one via selecting
“Download additional server adapters” link shown on top right corner.
e.
Click on button “Finish” and then “OK” on
previous window.
f.
Open Servers view (Window -> Show View ->
Servers)
Ensure the “JBoss EAP 6.0 Runtime” Server runtime environment is selected
and click on Finish.
i.
Specify correct path for JBoss EAP 6.0 and right
JRE
Click on Finish.
5.
You should see the project “HelloWorldServlet”
created. Now right click on project and click New -> Servlet.
Click on Finish.
7.
Make following changes on doGet() and doPost()
method as:
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
PrintWriter out =
response.getWriter();
out.print("<html><body><b>Respons
from HelloWorld Servlet</b></body></html>");
out.close();
}
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
doGet(request,
response);
Click on Finish.
9.
You should see “Console” view showing server
startup logs. Once server is started successfully a browser window will open
with URL http://localhost:8080/HelloWorldServlet
Testing
1.
You must hit the URL http://localhost:8080/HelloWorldServlet/HelloWorldServlet
either in Eclipse Web Browser window or any other Web Browser you have.
Congratulations
this completes your HelloWorldServlet which is a Servlet 3.0 Spec compliant
running in JBoss EAP 6.0.
The source code can be found here: https://github.com/mchopker/myprojects.git
ReplyDeleteconfloAconsyo_1980 Kathy Evans https://wakelet.com/wake/2shaWuF3hou7qN4xlwZ9_
ReplyDeleteunoritlac