JRun

For details, see Section 2.5.

Downloading the Software

  • http://www.macromedia.com/software/jrun/. Follow the instructions for obtaining the free trial version.

Bookmarking the Servlet and JSP APIs

You can access the APIs online; you can also download them to your machine for faster access.

Servlets 2.3 and JSP 1.2
  • Online Documentation: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/servletapi/

  • Download Documentation: http://java.sun.com/products/jsp/download.html

Servlets 2.4 and JSP 2.0
  • Servlet 2.4 Documentation (Online): http://jakarta.apache.org/tomcat/tomcat-5.0-doc/servletapi/

  • JSP 2.0 Documentation (Online): http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jspapi/

  • Servlet 2.4 and JSP 2.0 Documentation (Download): http://java.sun.com/products/jsp/download.html

Configuring the Server

Run the installation wizard and specify the following:

  • The serial number. Leave it blank for the free development server.

  • User restrictions. Limit the use of JRun to your account or make it available to anyone on your system.

  • The SDK installation location. Specify the base Java directory, not the bin subdirectory.

  • The server installation directory. Accept the default in most cases.

  • The administrator username and password. Pick any values you want, but write them down for later use.

  • The autostart capability. Do not identify JRun as a Windows service.

After completing the installation, go to the Start menu, select Programs, select Macromedia JRun 4, and choose JRun Launcher. Select the admin server and press Start. Next, open a browser and enter the URL http://localhost:8000/ . Log in with the username and password you specified during installation, then select Services under the default server in the left-hand pane. Next, choose WebService, change the port from 8100 to 80, press Apply, and stop and restart the server.

Setting Up Your Development Environment

  • Create a development directory. Develop code there; copy to the server's deployment directory for testing.

  • Set your CLASSPATH . Have it include install_dir /lib/jrun.jar , your main development directory, and " . " (the current working directory).

  • Make shortcuts to start and stop the server. Go to the Start menu, select Programs, select Macromedia JRun 4, right-click on the JRun Launcher icon, and select Copy. Then go to your development directory, right-click in the window, and select Paste Shortcut (not just Paste). There is no separate shutdown icon; the JRun Launcher lets you both start and stop the server.

Using the Default Web Application

The main location is install_dir /servers/default/default-ear/default-war .

Packageless Servlets
  • Code: install_dir /servers/default/default-ear/default-war/WEB-INF/classes

  • URL: http:// host /servlet/ ServletName

Packaged Servlets
  • Code: install_dir /servers/default/default-ear/default-war/WEB-INF/classes/ packageName

  • URL: http:// host /servlet/ packageName.ServletName

Packaged Beans and Utility Classes
  • install_dir /servers/default/default-ear/default-war/WEB-INF/classes/ packageName

JAR Files
  • install_dir /servers/default/default-ear/default-war/WEB-INF/lib

HTML and JSP Pages (Not In Subdirectories)
  • Code Location: install_dir /servers/default/default-ear/default-war

  • URL: http:// host/filename

HTML and JSP Pages (In Subdirectories)
  • Code Location: install_dir /servers/default/default-ear/default-war/ directoryName

  • URL: http:// host/directoryName/filename

Using Custom Web Applications

Create a Web application directory in install_dir /servers/default . The directory should have a WEB-INF subdirectory, a web.xml file in WEB-INF (copy the one from the default Web application), and a WEB-INF/classes subdirectory. Instead of a regular directory, you can also use a WAR file (JAR file with file extension renamed from .jar to .war ) with this structure. In the following, we use webappName to refer to the name of the directory (or the base name of the WAR file, minus . war ). See Section 2.11 for details.

Packageless Servlets
  • Code Location: install_dir /servers/default/ webappName /WEB-INF/classes

  • Default URL: http:// host/webappName /servlet/ ServletName

  • Custom URL: http:// host/webappName/AnyName

    ( designate / AnyName with servlet and servlet-mapping elements in web.xml )

Packaged Servlets
  • Code Location: install_dir /servers/default/ webappName /WEB-INF/classes/ packageName

  • Default URL: http:// host/webappName /servlet/ packageName.ServletName

  • Custom URL: http:// host/webappName/AnyName

    (designate / AnyName with servlet and servlet-mapping elements in web.xml )

Packaged Beans and Utility Classes
  • install_dir /servers/default/ webappName /WEB-INF/classes/ packageName

JAR Files
  • install_dir /servers/default/ webappName /WEB-INF/lib

HTML and JSP Pages (Not In Subdirectories)
  • Code Location: install_dir /servers/default/ webappName

  • URL: http:// host/webappName/filename

HTML and JSP Pages (In Subdirectories)
  • Code Location: install_dir /servers/default/ webappName / directoryName

  • URL: http:// host/webappName/directoryName/filename

Viewing Autogenerated Code for JSP Pages

You can view the servlet code that JRun generates from your JSP pages. However, JRun does not save the .java files unless you change the keepGenerated element from false to true in install_dir /servers/default/SERVER-INF/default-web.xml .

  • Default Web Application: install_dir /servers/default/default-ear/default-war/WEB-INF/jsp

  • Custom Web Applications: install_dir /servers/default/ webappName /WEB-INF/jsp



Core Servlets and JavaServer Pages (Vol. 1.Core Technologies)
Core Servlets and Javaserver Pages: Core Technologies, Vol. 1 (2nd Edition)
ISBN: 0130092290
EAN: 2147483647
Year: 2002
Pages: 194

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net