Vous n'êtes pas connecté. Connexion
|
|
JavaEE6 Weblogic exercice 1De $1IntroductionIn this exercice we will write a JavaEE application that uses the new "web profile": a single project that can use JSF/JSP/Servlets/Web Services/EJBs/JPA with some limitations (no message driven beans, no timer, etc.) and one advantage: it is easier to manage as all components are located in a single project, and deployment is done in a single jar file. We will use a javaDB/Derby database for this application. Install the different components
Creating a "web profile JavaEE 6 project", write a servlet and an EJB for testingCreate a standard dynamic web project using Eclipse, call it for example "Exo1WebProfile". Click twice on the next button and in the last screen, check "Generate web.xml descriptor". Normally we do not need any XML settings in that file (JavaEE 6 replaced the need to XML settings by code annotations) but it will be useful to set the starting URL when we run the project in that file. Add a Servlet in the project, call it TestServlet, and add it in a package named "servlets". Click finish. Add some lines in the doGet() method, like these: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Set the response message's MIME type. response.setContentType("text/html;charset=UTF-8"); // Allocate a output writer to write the response message into the network socket. PrintWriter out = response.getWriter(); out.println("<h1>Welcome to Exo1 test servlet!</h1>");}
|
Powered by MindTouch Deki Open Source Edition v.8.08 |