JavaServer Pages guidelines

Related Topics ...

Overview: Creating Pages

Javascript Guidelines

HTML Guidelines

We can incorporate JavaServer Pages (JSPs) into your models using the following builders:

  • JSP Directive -- Adds JSP directives to a page in the model.

  • JSP Proxy Page -- Routes requests to an existing JSP page to an action in the model, allowing you to "insert" model functionality into an existing JSP application.

  • JSP Tag -- Allows you to use a JSP Tag library within a page in the model.

In addition to these JSP-specific builders, we can also hand code JSP or use existing JSP in any Factory pages (Imported Page builder, Page builder, Imported Directory builder, etc.), as long as they do not perform the following actions:

  • Forwarding

  • Setting response headers

Factory pages are always invoked using "include", disallowing these actions.

The Imported Directory builder can often work quite well for bringing in a set of existing JSP's, including inter-page actions/links, provided that they adhere to the caveats above.

 

Processing Redirections

If any of the JSP pages that you import for use in a model contain any redirection code, you will need to re-implement this behavior with a method in your model.

For example, if a page in your model contains the following JSP code, we need to create a method that processes the appropriate page.

<%

  response.sendRedirect(response.encodeRedirectURL("http://127.0.0.1:7001/MyApp/results/success.html"));

%>

The action that processes this page needs to be altered to include any logic contained in the JSP page and to process the success.html page. You should import the success.html with a call to the Imported Page builder.

For example, the method in your model would contain code similar to the following:

...

// incorporate any logic in JSP here.

webAppAccess.processPage("SuccessPage");

...