JSF Quickstart With MyEclipse---7
天下维客,你可以修改的网络知识库
|
JSF编辑 相关文档:
其他资源: |
Running the Application
In this section we will quickly show what our new application looks like when its running.
We will use MyEclipse to deploy our application to Tomcat 5 and then launch the server so we can run the application. Complete details in how to set up an application server and deploy to it within MyEclipse is available in the Application Server Quickstart. For the purposes of this example, we're going to assume that Tomcat 5 has already been configured for our use and we simply need to deploy our application to it. Deployment is done by the Manage Deployments dialog, which can be activated from the project's context menu by right-clicking on the project in the Package Explorer View and selecting MyEclipse > Add / Remove Deployments... The Manage Deployments dialog, shown in Figure 19, will be launched. To add a deployment, simply click the Add button and the New Deployment wizard, shown in Figure 20, will be launched.
Figure 19 - Manage Deployments Dialog
Figure 20 - New Deployment Wizard
Select Tomcat 5 as the server, exploded archive as the deployment type, and select Finish as shown in Figure 20. After the wizard completes execution, the Deployment Manager will show that the deployment was successful. This is depicted in Figure 21. Now that the deployment has completed, you can select OK to close the dialog.
Figure 21 - Successful Deployment
At this point the Tomcat 5 server can be started by selecting Start from the Tomcat 5 management menu from the main Eclipse toolbar, as shown in Figure 22, below.
Figure 22 - Starting Tomcat 5
The output from the server log will be redirected to the Eclipse Console View. From the log shown in Figure 23, it is evident that the sever started successfully and that our example application was deployed.
Figure 23 - Tomcat 5 Startup Log
Once Tomcat 5 is running, we can test it by opening the MyEclipse Browser View. This can be done from the Open View dialog that is accessed by selecting Window > Show View > Other... then selecting the MyEclipse Web Browser View, as shown in Figure 24.
Figure 24 - Opening the Web Browser View
In the browser's address bar, enter <a href="http://localhost:8080/JSFLoginDemo/userLogin.faces" class="external free" target="_blank" title="http://localhost:8080/JSFLoginDemo/userLogin.faces" rel="nofollow">http://localhost:8080/JSFLoginDemo/userLogin.faces</a> to activate the example application, as shown in Figure 25.
Figure 25 - Accessing the Example Application
You can try logging in with incomplete or incorrect credentials and see how the error message is displayed, as in Figure 24. Or, you can log in with the username and password both set to 'myeclipse' (without the quotes) to see the application redirect to the "success" page, as shown in Figure 26.
Figure 26 - Invalid Login
Figure 27 - Successful Login
We see our navigation rules kick in as we are validated and directed to the userLoginSuccess.jsp page where our name is displayed. While this application is certainly simple, it does convey the basics of developing a JSF application using MyEclipse.
Summary
In this demo we took a look at developing a simple JSF application using MyEclipse Enterprise Workbench. In the current release of MyEclipse (3.8.2) support for JSF is centered around project capabilities as well as strong editor (XML, JSP, etc.) support with auto-completion and validation. Moving forward, as early as MyEclipse 3.9, we will start to integrate extended JSF tooling support. Eventual JSF tooling will provide visual faces-config.xml editing along the lines of our struts-config.xml designer and integration of a visual JSP designer with support for drag and drop JSF building.
While this support will not all be immediately available in MyEclipse 3.9, more and more JSF support and extended tooling will be integrated into the MyEclipse development environment to provide a more comprehensive set of tools going forward.
This concludes your introduction to JSF. Additional Quickstart documents are available that introduce working with Web Projects, editing, application server configuration, enterprise application projects and database development.











