Show TOC Start of Content Area

Procedure documentation Tutorial 1: Step 2 – Developer 2 Enhances the Projects  Locate the document in its SAP Library structure

Use

In this step, a second developer – developer 2 adds some code to the newly created projects.

Prerequisites

You work in the SAP NetWeaver Developer Studio.

Procedure

Access and Sync Project Files in the Design Time Repository (DTR)

       1.      To open the Design Time Repository perspective, choose Window Open Perspective Other Design Time Repository.

       2.      To log in to the DTR, choose the Log On… (This graphic is explained in the accompanying text) button in the toolbar.

       3.      Enter user USER2 and the corresponding password.

The Design Time Repository perspective appears. In the Repository Browser view you will see the folder structure on the DTR server.

       4.      Browse the structure and locate workspace scenario1/tax/dev.

       5.      Choose the projects folder with the secondary mouse button and chooseSync from the context menu.

This will replicate the projects TaxEAR and TaxWeb to your local file system.

Note

Open the project node and check whether the files .classpath and .projects exist. If they are missing, you must make the setting for all Developer Studios in the team as described under Scenario 1: Preparation  Select Files for Automatic Storage in the DTR.

       6.      Create projects in your file system. You need projects to be able to edit files.

                            a.      Select folder TaxEAR and choose Create Project from the context menu.

                            b.      Accept the default project name and press the OK button.

                            c.      Select folder TaxWeb and choose Create Project from the context menu.

                            d.      Accept the default project name and press the OK button.

Edit Files Synced from the DTR

...

       1.      Open the J2EE Development perspective and switch to the J2EE Explorer view.

       2.      Select the TaxWeb project and choose New JSPfrom the context menu.

       3.      In the dialog that appears enter the name tax and choose OK.

A dialog window appears.

       4.      To create a new activity for your changes, in the dialog choose New.

       5.      Enter Add Content as display name of the new activity.

       6.      Enter a description of the activity and choose OK.

A dialog window appears.

       7.      Select the new activity (if necessary) and again choose OK.

A dialog box appears.

       8.      Confirm the file selection with OK.

       9.      Again select the activity Add Content.

The file tax.jsp now is attached to the activity but not yet checked in.

The JSP source appears.

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

<%@ page language="java" %>

<html>

<head><title>Tax Calculator</title></head>

<body bgcolor="#c8e3ff">

<h1>Simple Tax Calculator</h1>

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

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

    <colgroup><col width="20%"/>

      <col width="80%"/> </colgroup>

    <%  double income;

      try{

        income = Double.parseDouble(request.getParameter("income"));

      }catch(Exception e){

        income = 0; } %>

    <tr><td>Income:</td>

      <td> <input name="income" value="<%= income %>" 

            type="text" size="30" maxlength="40">

      </td></tr><tr>

      <td>Tax:</td> <td> <%= (income * 0.3 ) %> </td>

    </tr><tr>

      <td colspan="2" align="center">

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

  </table> 

</form>  

</body>  

</html>

   11.      Save your entries.

   12.      In the J2EE Explorer view select the TaxEAR project and choose Add Modules from the context menu.

A dialog box appears.

   13.      Choose the TaxWeb project in the dialog and choose OK.

A dialog window appears.

   14.      Confirm the question whether to check out files.

A dialog box appears.

   15.      Select the existing activity Add Content.

Your changes are attached to this activity.

Note

Usually, the activities are checked in only after building and testing the sources. After they are checked in, the versions contained in them are available for the team on the server. This is done in the next step.

Next Step

Tutorial 1: Step 3 – Building, Deploying, and Running Projects

End of Content Area