Products Downloads


French version


 

 

To create a detail using an Adelia JavaBean:

1.     Create a blank new JSP page.

This page must have the ".jsp" extension. In our example, this page is called "detailcust.jsp".

 

 

 

2.     Build the page in HTML, carefully placing the fields that you want to display.

Insert all this HTML code in a form, adding three buttons (Create, Modify and Delete).

 

 

3.    The purpose of this page is not only to display an entity's details, but also to let the user create a new entity (in which case, the detail fields will be empty).

      • Enter the following code directly into the page's HML source.

 

<TITLE>Customer's detail</TITLE>

<BODY>

 

<jsp:useBean class="com.hardis.adelia.pool.PoManager" id="Manager" scope="application"></jsp:useBean>

<jsp:useBean class="com.hardis.training.FDETCL" id="fDETCL"></jsp:useBean>

 

<%

String sAction=request.getParameter("CODACTION");

String sCode=request.getParameter("CODECLI");

 

 

// Other possibilities in the JSP page : DETAIL

 

if (sAction.equals("DETAIL"))

Manager.refresh(fDETCL);

 

 

if (!fDETCL.isOK())

response.sendRedirect("erreur.jsp");

 

%>

 

<BR>

<P align= "center" ><IMG src= "images/banniereweb.gif" width= "468" height= "60" border= "0" ></P>

<HR width= "70%" size= "4" style= "color : navy;" >

<P align= "center" ><B><FONT color= "#cc0000" size= "4" face= "MS Mincho" >

 

 

// Writing the title : Creation or Detail of a record

 

<%= (sAction.equals("CREATE") ? "Create a new customer" : "Details of a customer") %>

 

<%

com.hardis.training.FDETCL$StructLST_CUST _p0=null;

try {

_p0 = fDETCL.getLST_CUSTEnumeration (0);

     }

catch (Exception e) { }

%>

 

</FONT></B></P>

<HR width= "70%" size= "4" style= "color : navy;" >

 

 

By the end of this step, the various operations will be differentiated and the details retrieved: you now need to specify all the fields on the page.

 

    • You need to place a condition in each field, which will distinguish between the CREATE and DETAIL modes.
      Double-click in each field and place the relevant code in the "initial value" option.

<%= (sAction.equals("CREATE")?"":_p0.getCU_CUS_NAME()) %>

 

 

↑ Top of page

  • Aucune étiquette