Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Advanced Internet Programming - Architecture - Lab exercise - Familiarisation 1 31242/32549/ AJPCPEAdvanced Internet Programming INFO: What's New FAQ Software Machines Oracle Assignments MODULES: 00 Admin 01 Intro 02 Architecture 03 Servlets 04 JSP 05 JDBC 06 RMI 06 JNDI 07 EJB 08 XML 08 Web Services 09 Security 10 Transactions 11 Legacy 12 Review 99 Design LINKS: START page Faculty of IT UTS Module: Architecture Lab exercise - Familiarisation 1 - Installing Eclipse The laboratory exercise for this module to install Eclipse and then develop a one or two static HTML pages Level of Difficulty: 2 (moderately easy) Estimated time: 30 minutes Pre-requisites: Completed WebLogic setup lab exercise Running Eclipse Eclipse  has been pre-installed on the lab workstations. You can start this via Applications → Programming → eclipse-oracle You MUST use the "oracle" version of eclipse, not the "wtp" verson. You now should see the Eclipse workspace launcher start. You will eventually see a prompt to enter the workspace directory. Leave the default (workspace), just be aware that you can change this and Eclipse will automatically create a directory for you with that name in your home directory. You will then get the Welcome screen (this only happens the first time you create a workspace) You should click on the X on the [Welcome] tab to get the following workspace window: This is the main Java EE "perspective". If you don't see this, click on the Window → Open Perspective → Other → Java EE (default) Or click the perspective button on the left-hand side of the current perspective and select the 'Java EE' perspective (Please look at the screenshot above). Arranging your windows Before you begin the setup instructions below, you will probably find it helpful to rearrange your windows so that this browser window and your Eclipse workspace window are side-by-side. This will save you flipping back and forth between the instructions and eclipse. Add Server Before creating a new Java EE project, we need to add a Java EE application server that is weblogic for this course. To add a new server, Click on the Window → Preferences Expand the 'Server' category → Select 'Runtime Environments' → Click the Add button Select the Oracle WebLogic Server 11gR1 PatchSet 2 under the Oracle category → Click the Next button Enter WebLogic home and Java home. WebLogic Home: /opt/oracle-middleware/wlserver Java Home: /usr/java/default If the 'Finish' button is not enabled, click the 'Back' button. Then click the 'Next' button again → Now the 'Finish' button is enabled → Click the Finish button As you can see, the 'Oracle WebLogic Server' is added to the Server Runtime Environment. Click the OK button Select the 'Server' view → Right-click inside the Server View panel → New → Server Click the Next button In the "Domain directory" box, enter /home/your_username/weblogic (Your user name is your student number). Oracle WebLogic Server 11gR1 PatchSet 2 is added to the Server view Creating a project To create a new Java EE project, we are going to create a Web application first. Step 1: From the Project Explorer:, Right Mouse Button click→ New→Project → Dynamic Web Project (alternatively: Choose the File-→New→Other→Web→Dynamic Web Project ) Enter the project name: labs Make sure the Target runtime is Oracle WebLogic Server 11gR1 Patch Set 2 and Dynamic Web Module version is 2.5 and  a new default configuration for Weblogic. Depending on your server runtime chosen, Eclipse will display different information. Our first main exercise will be to just create a plain old web page. Deploying static HTML The next challenge is to create HTML files for our web site. From Project Explorer select Labs   Now Right Mouse Button click -> New > HTML  → (note: WebContent is highlighted) We choose a filename: index.html & press [Next] At the Select HTML Template panel: HTML 4.01 Transitional & press [Finish] You can now see it generates a HTML page which you can edit. Why not add some text or HTML formatting tags - change the title and maybe add a

in the body would be nice. You can use the Design Palette on the lower left hand corner to add new widgets etc. Just double click the icon and a wizard will pop up. Use Ctrl-S (or File->Save) to save this file. Running the HTML page Before you can start testing, you need to define a server to run this web page one. We will use Weblogic as a normal web server for the moment. Select the labs project in the Project Explorer and press the Right mouse button Select Run As -> Run on Server You will get a Run on server panel: If you have successfully created your server in a previous step, select Choose an existing server and Press [Finish]. Leave the defaults. If you have more than 1 server defined, this is where you can choose which server to test your page on. In our case, we will just use Weblogic, so  select [x] Always use this server when running this project Press [finish] to continue. You should get weblogic server starting in a new window - see the Console view on the bottom right hand side for % progress) Wait till the  message appears. A browser window should appear in eclipse with your web page! You can add many extra pages. Try make them link eg: If you get an error message saying "Publish was cancelled" this could be because your server and project is already running. If this is the case, you could start the server manually, by pressing the green arrow If you double-click on the server name (eg: "Oracle Weblogic Server V10.3" above), you can also get the server configuration settings. This will allow you to manually remove (ie: "undeploy" ) a project which may be preventing weblogic from starting (for example, "labs" ) If you need to restart the internal browser for any reason, use Window -> Show View -> Other -> General -> Internet Web Browser Note: it is better to start an external browser, as the internal browser may not support all the latest browser functionality. Test to see that your new application works. In a browser, open a URL like: http://localhost:7001/labs/index.html Note that in most cases you will have a "Context root" which is effectively a subdirectory. So if our web Context root was, for example, labs,  our URL would be:   http://localhost:7001/labs/index.html Notes: Write down notes as you go, particular parts of the process that seem difficult or confusing. Ask questions. Use the WebLogic documentation to help you (start to become familiar with browsing the documentation). You can find the documentation at: http://download.oracle.com/docs/cd/E14571_01/ For an introduction to WAR files, JAR files and EAR files, read http://download.oracle.com/docs/cd/E14571_01/web.1111/e14529/developing_applications.htm This will give you a head start on some of the later course material. 2008 University of Technology, Sydney. All Rights Reserved. Redistribution without permission prohibited.