Show TOC Start of Content Area

Procedure documentation Creating JSF JSP Files  Locate the document in its SAP Library structure

Use

Typically, JSF user interfaces are JSP pages that contain JSF expression language tags in addition to the HTML and JSP content.

In the SAP NetWeaver Developer Studio, you create JSF-enabled JSP files in the same way in which you create ordinary JSP files. After that, however, you need to describe the JSP files in the faces-config.xml using the multipage editor.

Procedure

1. Create the JSP Page File and Source Code

...

       1.      Create a standard JSP file in the Dynamic Web Project, choosing an appropriate HTML template.

See Creating JSP Files.

The Developer Studio generates a JSP file with basic HTML code.

       2.      Add the taglib description tags in the source code, and save.

Example

The source code with taglibdescription may look like this:

<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

   

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Insert title here</title>

</head>

<body>

 

</body>

</html>

       3.      Using the code assistance and validation options, implement the JSP source code, and save it.

2. Add the JSP Page to the faces-config.xml

...

       1.      Open the faces-config.xml for editing.

       2.      Add the corresponding navigation rule for access to and from this page.

Example

The following code example shows that deptList.jsp will lead to deptDetails.jsp if the departments_selected condition is available. The deptDetails.jsp will then lead back to deptList.jsp if the departments_updated condition is available.

<navigation-rule>

    <from-view-id>/deptList.jsp</from-view-id>

    <navigation-case>

      <from-outcome>departments_selected</from-outcome>

      <to-view-id>/deptDetails.jsp</to-view-id>

    </navigation-case>

  </navigation-rule>

 

  <navigation-rule>

    <from-view-id>/deptDetails.jsp</from-view-id>   

    <navigation-case>

      <from-outcome>departments_updated</from-outcome>

      <to-view-id>/deptList.jsp</to-view-id>

    </navigation-case>   

  </navigation-rule>

The from-outcome content defines the condition on which the navigation rule or case will take effect. Such conditions are triggered when command buttons are pressed. Command buttons are bound with manaded bean methods executed when they are pressed. The implementation of the methods returns as Strings the resulting conditions.

More information:

Command Buttons

Managed Beans

End of Content Area