} }

 Files   Prepare   Run   Troubleshooting   Related Topics 

 

About the Example

This example illustrates some new JSP 2.0 features. You can create a customized tag using a tag file that contains JSP and JSTL (JSP Standard Library Tag) code. JSTL allows Web designers to produce scriptless JSP pages that do not contain Java code. The tag file also uses one of three new directives <%@attribute%> to demonstrate dynamic attributes.

This example demonstrates an Address Label Creator written in JSP. The client enters a customer's address information into the input fields. The client also enters the number of rows to be produced. After submission, the input field values are passed to the customized tag, <mail:tagHandler>, for processing.

Output: The client should see the customer's address printed in three separate columns. The number of rows is dynamically generated based on the value entered on the form field labeled "Number of Rows".


 

Files Used in the Example

Directory Location:

MW_HOME/wlserver_10.3/samples/server/examples/webapp/jsp/tags/taghandler/

(where MW_HOME is the directory containing your Oracle WebLogic Server installation)

File

Click source files to view code.

Description

application.xml Java EE standard enterprise application deployment descriptor.
build.xml Ant build file that contains targets for building and running the example.
ExamplesFooter.jsp Java Server Page containing the Example Footer.
ExamplesHeader.jsp Java Server Page containing the Example Header.
TagHandler.jsp Java Server Page containing the Tag Handler.
tagHandler.tag Tag Handler tag.
web.xml Java EE standard Web application deployment descriptor.
weblogic.xml Oracle WebLogic Server-specific Web application deployment descriptor.
weblogic-application.xml Oracle WebLogic Server-specific enterprise application deployment descriptor.
wls_examples.css Oracle WebLogic Server samples cascade style sheet.

 

Prepare the Example

 

Prerequisites

Before working with this example:

  1. Install Oracle WebLogic Server, including the examples.
  2. Start the Examples server.
  3. Set up your environment.

 

Configure Oracle WebLogic Server

  No special configuration is required for this example

 

Build and Deploy the Example

To build the example, follow these steps:

  1. Change to the SAMPLES_HOME\server\examples\src\examples\webapp\jsp\tags\taghandler directory, where SAMPLES_HOME refers to the main Oracle WebLogic Server examples directory, such as d:\Oracle\Middleware\wlserver_10.3\samples.
  2. Execute the following command:

    ant build

    This command compiles and stages the example.
  3. Execute the following command:

    ant deploy

    This command deploys the example on the wl_server domain of your Oracle WebLogic Server installation.

The Ant command uses the build.xml file, located in the SAMPLES_HOME\server\examples\src\examples\webapp\jsp\tags\taghandler directory, to build the example.

Running the build script builds the EJB in split development directory format where compiled and generated classes are placed in SAMPLES_HOME\server\examples\build\jspTagHandlerEar and non-compiled files remain within the source directory of the example. For more information on split development directory, see Developing Applications for Oracle WebLogic Server.


 

Run the Example

To run the example, follow these steps:

  1. Complete the steps in the "Prepare the Example" section.
  2. In your development shell, run the JSP Tag Handler example by using the following command from the example directory (SAMPLES_HOME\server\examples\src\examples\webapp\jsp\tags\taghandler):

    prompt> ant run

    This command executes the build.xml run target, which opens your default browser to the following URL:

    http://localhost:port/jsp_tagHandler/TagHandler.jsp

    Where:

    Note: To execute a Web-based example, you can manually open the browser to the appropriate URL or you can use the build.xml run target by entering ant run at the command prompt. The latter is the Oracle suggested method for running this example.

  1. If your example runs successfully, you will see a JSP page containing an Address Label Creator containing five data input fields:

    Full Name

    Street

    City, State/Province

    Zip Code

    Country

    Row of Labels


 

Troubleshooting


 

Related Topics

(Internet connection required.)