Show TOC Start of Content Area

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

Use

In this step you create a new JSP.

Prerequisites

You are in the J2EE Development perspective in the J2EE DC Explorer view.

Procedure

...

       1.      Open the project node of your Web Module DC (...appli~tax~servlet~...).

       2.      In the context menu, choose New JSP.

       3.      In the dialog, enter tax and choose Finish.

A dialog window DTR Activity appears.

       4.      Select New J2EE Application and choose OK.

The JSP editor is opened automatically.

       5.      Switch to the Source pane and enter the following code:

<%@ page language="java"%>

<html>

<head>

<title>Tax Calculator</title>

</head>

<body bgcolor="#c8e3ff">

<form action="tax.jsp" method="POST">

<table border="0" cellspacing="5" cellpadding="5">

   <colgroup>

      <col width="20%" />

      <col width="80%" />

   </colgroup>

   <%

      org.example.tax.web.TaxUIController controller =

      new org.example.tax.web.TaxUIController();

      controller.setIncome(request.getParameter("income"));

   %>

   <tr>

      <td>Income:</td>

      <td><input name="income" value="<%= controller.formatIncome() %>"

         type="text" size="30" maxlength="40"></td>

   </tr>

   <tr>

      <td>Tax:</td>

      <td><%=controller.formatTax()%></td>

   </tr>

</table>

<table border="0" cellspacing="5" cellpadding="5">

   <colgroup>

      <col width="30%" />

      <col width="40%" />

      <col width="30%" />

   </colgroup>

   <tr>

      <td></td>

      <td><input type="submit" value="calculate tax"></td>

      <td></td>

   </tr>

</table>

</form>

</body>

</html>

       6.      Save your changes.

Result

You have created the required JSP.

Next Step

Creating a Java Class

 

End of Content Area