|
Home TOC |
|
Search
Feedback |
Updating Web Components
During development, you will often need to make changes to web components. To update a servlet you modify the source file, recompile the servlet class, update the component in the WAR, and redeploy the application. Except for the compilation step, you update a JSP page in the same way.
To try this feature, first build, package, and deploy the JSP version of the Hello application:
- Go to
j2eetutorial/examples/srcand build the example by runningant hello2.- Create a J2EE application called
Hello2App.
- Select File->New->Application.
- In the file chooser, navigate to
j2eetutorial/examples/src/web/hello2.- In the File Name field, enter
Hello2App.- Click New Application.
- Click OK.
- Create the WAR and add the
greetingweb component and all of theHello2Appapplication content.
- Invoke the web component wizard by selecting File->New->Web Component.
- In the combo box labelled Create New WAR File in Application select Hello2App. Enter
Hello2WARin the field labeled WAR Display Name.- Click Edit to add the content files.
- In the Edit Contents dialog, navigate to
examples/build/web/hello2. Select greeting.jsp, response.jsp, and duke.waving.gif, and click Add. Click OK.- Click Next.
- Select the JSP radio button.
- Click Next.
- Select greeting.jsp from the JSP Filename combo box.
- Click Finish.
- Add the alias
/greetingfor thegreetingweb component.- Specify the context root
hello2.- Deploy Hello2App.
- Execute the application by pointing a web browser at
http://<host>:8000/hello2/greeting. Replace<host>with the name of the host running the J2EE server.Now modify one of the JSP files. For example, you could replace the contents of
response.jspwith:<h2><font color="red">Hello, <%=username%>!</font></h2>Thus, to update the file in the WAR and redeploy the application:
- Edit
response.jsp- Execute
ant hello2to copy the modified file to the build directory.- Select Hello2App.
- In the deploytool, select Tools->Update Files.
- A dialog appears reporting the changed file.Verify that response.jsp has been changed and dismiss the dialog.
- Select Tools->Deploy. Make sure the checkbox labeled Save object before deploying is checked.
You can also perform steps 4. through 6. by selecting Tools->Update and Redeploy. The
deploytoolreplaces the old JSP file inHello2App.earwith the new one and then redeploys the application.When you execute the application, the color of the response should be red:
|
Home TOC |
|
Search
Feedback |