[Webtest] Re: About setinputfield

sunshuli webtest@lists.canoo.com
Tue, 18 May 2004 17:16:09 +0800


This is a multi-part message in MIME format.

------=_NextPart_000_006B_01C43CFB.CF976580
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi,

Attached is the source code (CreateSvcrt.jsp), due to the message capaticy
is limited, i will send you the result with running the jsp
(CreateSvctr.doc) later.

thanks a lot.
sunshuli

----- Original Message -----
From: "Marc Guillemot" <mguillemot@yahoo.fr>
To: <webtest@lists.canoo.com>
Sent: Tuesday, May 18, 2004 4:45 PM
Subject: [Webtest] Re: About setinputfield


> Hi,
>
> can you please show the html code (ie what your browser receives) and not
the source of the "script" that generates it.
>
> How do you imagine which field should be set in each iteration? You can't
get any correspondance on the server side
> between your checkboxes and your text fields.
>
> Marc.
>
>
> sunshuli wrote:
> >   Hi, All
> >
> >   There is a problem about setinputfield need your help:
> >
> >   When I do test with <Setinputfield>,I need to input many values in
some
> > text fields,For these text fields in different lines base on loop
method,and
> > there is a same name for these fields in html.
> >
> >   I need to give multi different values into these same name textfileds
in
> > loop method.
> >   But, i can't get expect result.( We hope we can get the result ,A,B,C
not
> > porCD.value${i} in textfield)
> >   We got :
> >
> >   Porcode:
> >        [echo] pocCD.value
> >        [echo]
> >
> >   all:
> >        [echo] pocCD.value
> >        [echo]
> >        [echo] pocCD.value.${i}
> >        [echo]
> >
> >   BUILD SUCCESSFUL
> >
> >     Could you help me what's matter with  my test script?
> >
> >   Bellow is source of html, please as reference
> >
> >   for(int i = 0; i < tmpPocCd.length; ++i) { %>
> >    <tr CLASS="HL">
> >    <td  > <input type="checkbox" name="selected" value="<%= i %>"></td>
> >    <td><%= i+1 %> </td>
> >    <td>
> >
> >   <input type="text" name="pocCd" size="5" maxlength="5" Value="<%=
> > tmpPocCd[i]==null ?  : tmpPocCd[i] %>">
> >    </td>
> >
> >   Bellow is test script, please as reference.
> >
> >              ....
> >
> >   <!--Repeat-->
> >
> >
> >
> >                    <repeat count="3" countername="row">
> >
> >
> >
> >                      <setinputfield
> >
> >                           stepid="set Port Code in Select Update Sailing
> > Schedule Detail page"
> >
> >                           name="pocCd"
> >
> >                           value="${pocCD.value}"/>
> >
> >                   </repeat>
> >
> >              ....
> >
> >    <target name = "Porcode" >
> >
> >
> >
> >             <loadproperties
> > srcFile="${webtest.home}/canoo/Porcode1.properties"/>
> >
> >                   <echo>Porcode pocCD.value.${i}
> >
> >           </echo>
> >
> >             <antcall target="porcodefile1" >
> >
> >             </antcall>
> >
> >           </target>
> >
> >          <target name="porcodefile1">
> >
> >               <propertyfile
> > file="${webtest.home}/canoo/Porcode1.properties">
> >
> >                   <entry  key="i" type="int" operation="+" value="1"/>
> >
> >           </propertyfile>
> >
> >
> >
> >           <echo>procodefile1 pocCD.value.${i}
> >
> >           </echo>
> >
> >             <antcall target= "getvalue">
> >
> >                   </antcall>
> >
> >      </target>
> >
> >
> >
> >              <target name="getvalue">
> >
> >                     <loadproperties
> > srcFile="${webtest.home}/canoo/Porcode1.properties"/>
> >
> >                     <echo>getvalue pocCD.value.${i}
> >
> >                     </echo>
> >
> >                    <antcall target="all">
> >
> >                    </antcall>
> >
> >              </target>
> >
> >
> >
> >       Bellow is my Porcode.properties:
> >
> >   i=1
> >
> >   pocCD.value.3=C
> >
> >   pocCD.value.2=B
> >
> >   pocCD.value.1=A
> >
> >
> >
> >      Anyone can help?
> >
> >    Thanks a lot.
>
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest

------=_NextPart_000_006B_01C43CFB.CF976580
Content-Type: application/octet-stream;
	name="CreateSvcrt.jsp"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="CreateSvcrt.jsp"

<%@ include file=3D"./VSSHeadJsp.jsp"%>
<% com.portnet.security.SecurityManager.checkJSPAuthorization(request, =
response, "ServiceRoute.VSS_CreateServiceRoute");%>
<jsp:useBean id=3D"bean" =
class=3D"com.portnet.business.VSS.generic.CreateSvcrtHandlerBean" =
scope=3D"request" />
<jsp:setProperty name=3D"bean" property=3D"encodeGetterValues" =
value=3D"true"/>

<input type=3D"hidden" name=3D"requestID" value=3D"createsvcrt">

<table>
<tr>
    <td>&nbsp;</td>
 </tr>
</table>


<table width=3D"100%" border=3D"0">


<tr>
<td><div align=3D"left">

<% if (bean.containsError())  { %>
  <%=3D bean.printErrorMessages() %>
<% }  %>

 </div></td></tr>

    <tr > <img src=3D<%=3DlabelRa.getMessageString("CRSVRT")%>> </tr>

  <tr valign=3D"middle">
      <td>&nbsp;</td>
  </tr>
  <% if (bean !=3D null)  { %>
    <input type=3D"hidden" name=3D"byteCount" value=3D"<%=3D =
bean.getByteCount() %>">
  <%  } %>

  <tr valign=3D"middle" align=3D"center">
    <td height=3D"33">

      <table width=3D"100%" border=3D"0">
        <tr>
            <TD class=3D"LM" height=3D"31" =
width=3D"23%">*<%=3DlabelRa.getMessageString("SVCRTNAME")%></td>
            <td height=3D"31" width=3D"22%">
              <input type=3D"text" name=3D"svcrtName" =
value=3D"<jsp:getProperty name=3D"bean" property=3D"svcrtName"/>">
          </td>
            <td class=3D"LM" height=3D"31" =
width=3D"20%">*<%=3DlabelRa.getMessageString("SVCRTDESCRIPT")%></td>
            <td colspan=3D"2">
              <input type=3D"text" name=3D"svcrtDesc" size=3D"30" =
value=3D"<jsp:getProperty name=3D"bean" property=3D"svcrtDesc"/>">
              <div align=3D"center"></div>
          </td>
        </tr>

	<% if(bean !=3D null){
	    if(bean.isTerminalUser(request) || =
bean.isPortnetOperator(request)){%>

         <tr>
           <td  class=3D"LM" height=3D"31" =
width=3D"23%">*<%=3DlabelRa.getMessageString("ORGCD")%></a></td>
           <td  height=3D"31" width=3D"22%"> <input type=3D"text" =
name=3D"orgCd" value=3D"<jsp:getProperty name=3D"bean" =
property=3D"orgCd"/>" size=3D"10"> </td>
          </tr>

         <% }
         } %>
           <tr>
            <td class=3D"LM" width=3D"23%" =
>*<%=3DlabelRa.getMessageString("SHPGLINE")%></td>
            <td width=3D"22%" >
              <%
      if (!bean.isTerminalUser(request) && =
!bean.isPortnetOperator(request)) {
      String[] tmp =3D null;
      if (bean !=3D null) {
        tmp =3D bean.getShippingCodeList();
      }
      if (tmp !=3D null)  { %>
        <select name=3D"shpgLineCd">
        <%
        for(int i =3D 0; i < tmp.length; ++i) { %>
          <option value=3D"<%=3D tmp[i] =3D=3D null ? "":tmp[i]%> " <%
          if (tmp[i] !=3D null)  {
            if (tmp[i].equalsIgnoreCase(bean.getShpgLineCd()))  { %>
              <%=3D "selected" %>
            <% }
          }
          %>><%=3D tmp[i] =3D=3D null ? "":tmp[i] %></option>
        <%
        } %>
        </select>
        <%
        for(int i =3D 0; i < tmp.length; ++i) { %>
          <INPUT TYPE=3D"hidden" NAME=3D"shippingCodeList" =
VALUE=3D"<%=3D tmp[i] !=3D null ? tmp[i]:"" %>">
        <%
        }
      }

  		} else  { %>
       <INPUT TYPE=3D"text" NAME=3D"shpgLineCd" VALUE=3D"<%=3D =
bean.getShpgLineCd() %>">
      <%
  		} %>
          </td>
            <td class=3D"LM" width=3D"20%" =
>*<%=3DlabelRa.getMessageString("VSLNAME")%></td>

            <td width=3D"15%" >
            <% if (bean !=3D null) {
        String[] tmp =3D null;
    		tmp =3D bean.getVslName();
    		if (tmp !=3D null) {
    		String tempvsl=3D"";
      		for (int i =3D 0; i < tmp.length; ++i) {
      		if(i=3D=3D0)
        	tempvsl=3D tempvsl+ ((tmp[i] !=3D null) ? tmp[i]:"");
        	else
        	tempvsl=3D tempvsl+" , "+ ((tmp[i] !=3D null) ? tmp[i]:"");
      	     	}%>
      	     	<%=3D tempvsl %>

     	       <% }
    	       }

    	        %>

            </td>
            <% if (bean !=3D null) {
        String[] tmp =3D null;
    		tmp =3D bean.getVslName();
    		if (tmp !=3D null) {
      		for (int i =3D 0; i < tmp.length; ++i) { %>
        	<INPUT TYPE=3D"hidden" NAME=3D"vslName" VALUE=3D"<%=3D tmp[i] =
!=3D null ? tmp[i]:"" %>">
      	    <% }
    	       }
    		tmp =3D bean.getVslRecNo();
    		if (tmp !=3D null) {
      		for (int i =3D 0; i < tmp.length; ++i) { %>
        	<INPUT TYPE=3D"hidden" NAME=3D"vslRecNo" VALUE=3D"<%=3D tmp[i] =
!=3D null ? tmp[i]:"" %>">
      	       <% }
    		}
  	    } %>


            <td width=3D"20%" >
              <div align=3D"center">

             <input type=3D"submit" =
name=3D"<%=3DVSSConstant.SELECTVSL%>" =
value=3D"<%=3DbuttonRa.getMessageString("SELECTVSL")%>">
            </div>
          </td>
        </tr>
      </table>


    </td>
  </tr>
  <tr>
     <TD CLASS=3D"H2">
       <%=3DlabelRa.getMessageString("PORTCDLIST")%>
     </TD>
  </tr>
  <tr>
    <td height=3D"21">
        <table  "width=3D100%" border=3D"0" align=3D"center">
          <tr>
            <td =
CLASS=3D"HL"><%=3DlabelRa.getMessageString("SELECTROW")%></td>
            <td CLASS=3D"HL">&nbsp</td>
            <td CLASS=3D"HL" colspan=3D"2">*
              <%=3DlabelRa.getMessageString("PORTCODE")%>
            </td>
            <td CLASS=3D"HL" >*
              <%=3DlabelRa.getMessageString("SAILTIMED")%>
            </td>
            <td CLASS=3D"HL" >*
              <%=3DlabelRa.getMessageString("SAILTIMEH")%>
            </td>
            <td CLASS=3D"HL">*
              <%=3DlabelRa.getMessageString("PORTTIMED")%>
            </td>
            <td CLASS=3D"HL">*
              <%=3DlabelRa.getMessageString("PORTTIMEH")%>
            </td>
            <td CLASS=3D"HL" >
              <%=3DlabelRa.getMessageString("TERMINALCD")%>
            </td>
            <td CLASS=3D"HL" colspan=3D"2">
              <%=3DlabelRa.getMessageString("OCP")%>
            </td>
          </tr>

          <%
  String[] tmpPocCd;
  String[] tmpSailDay;
  String[] tmpSailHour;
  String[] tmpPortDay;
  String[] tmpPortHour;
  String[] tmpOcpCd;
  String[] tmpTerm;
  String[] tmpSelected =3D null;

  if (bean =3D=3D null) {
    tmpPocCd =3D new String[10];
    tmpSailDay =3D new String[tmpPocCd.length];
    tmpSailHour =3D new String[tmpPocCd.length];
    tmpPortDay =3D new String[tmpPocCd.length];
    tmpPortHour =3D new String[tmpPocCd.length];
    tmpOcpCd =3D new String[tmpPocCd.length];
    tmpTerm=3Dnew String[tmpPocCd.length];



  } else {
    tmpPocCd =3D bean.getPocCd();
    tmpSailDay =3D bean.getSailDay();
    tmpSailHour =3D bean.getSailHour();
    tmpPortDay =3D bean.getPortDay();
    tmpPortHour =3D bean.getPortHour();
    tmpSelected =3D bean.getSelected();
    tmpTerm =3D bean.getTerminalCd();
    tmpOcpCd =3D bean.getOcpCd();


    if (tmpPocCd =3D=3D null) {
      tmpPocCd =3D new String[10];
    }
    if (tmpSailDay =3D=3D null) {
      tmpSailDay =3D new String[tmpPocCd.length];
    }
    if (tmpSailHour =3D=3D null) {
      tmpSailHour =3D new String[tmpPocCd.length];
    }
    if (tmpPortDay =3D=3D null) {
      tmpPortDay =3D new String[tmpPocCd.length];
    }
    if (tmpPortHour =3D=3D null) {
      tmpPortHour =3D new String[tmpPocCd.length];
    }
    if (tmpTerm =3D=3D null) {
      tmpTerm =3D new String[10];
    }
    if (tmpOcpCd =3D=3D null) {
      tmpOcpCd =3D new String[10];
    }
  }
  // Added for getting terminal codes
    String[] tmpline =3D null;

		if (bean !=3D null) {
  		tmpline =3D bean.getTerminalCodeList();
    }



  //finished for terminal codes

  for(int i =3D 0; i < tmpPocCd.length; ++i) { %>
          <tr CLASS=3D"HL">
            <td  > <input type=3D"checkbox" name=3D"selected" =
value=3D"<%=3D i %>"></td>
            <td><%=3D i+1 %> </td>
            <td>

                <input type=3D"text" name=3D"pocCd" size=3D"5" =
maxlength=3D"5" Value=3D"<%=3D tmpPocCd[i]=3D=3Dnull ? "" : tmpPocCd[i] =
%>">


            </td>
            <td>

              <%
                String s;
                int p=3Di+1;
                if(i<9)
                s=3DbuttonRa.getMessageString("SELECTPORT")+"  "+p;
               // s=3D"Select Port  "+p;
                else
                s=3DbuttonRa.getMessageString("SELECTPORT")+p;
               // s=3D"Select Port"+p;
                %>
                <input type=3D"submit" name=3D"action" value=3D"<%=3D s =
%>">

            </td>
            <td>

                <input type=3D"text" name=3D"sailDay" size=3D"3" =
maxlength=3D"3" value=3D"<%=3D tmpSailDay[i]=3D=3Dnull ? "" : =
tmpSailDay[i] %>">

            </td>
            <td>

                <input type=3D"text" name=3D"sailHour" size=3D"3" =
maxlength=3D"3" value=3D"<%=3D tmpSailHour[i]=3D=3Dnull ? "" : =
tmpSailHour[i] %>">

            </td>
            <td>

                <input type=3D"text" name=3D"portDay" size=3D"3" =
maxlength=3D"3" value=3D"<%=3D tmpPortDay[i]=3D=3Dnull ? "" : =
tmpPortDay[i] %>">

            </td>
            <td>

                <input type=3D"text" name=3D"portHour" size=3D"3" =
maxlength=3D"3" value=3D"<%=3D tmpPortHour[i]=3D=3Dnull ? "" : =
tmpPortHour[i] %>">

            </td>

            <td>

                <select name=3D"terminalCd">

                  <%
  	              if (tmpline !=3D null) {
    		          for(int j =3D 0; j < tmpline.length; ++j) {
    		          %>
      		        <option value=3D"<%=3D tmpline[j] =3D=3D null ? =
"":tmpline[j] %>"  <% if (tmpline[j] !=3D null)  {
                                                        if =
(tmpline[j].equalsIgnoreCase(tmpTerm[i]))  { %>
                                                          <%=3D =
"selected" %>
                                                        <%  }
      		                                             }
                                                        %>><%=3D =
tmpline[j] =3D=3D null ? "":tmpline[j] %></option>
    		          <% }
  		            }%>
               </select>


            </td>



            <td>

                <input type=3D"text" name=3D"ocpCd" size=3D"5" =
maxlength=3D"5" Value=3D"<%=3D tmpOcpCd[i]=3D=3Dnull ? "" : tmpOcpCd[i] =
%>">


            </td>
            <td>

              <%
                String s1;
                int p1=3Di+1;
                if(i<9)
                s1=3Ds=3DbuttonRa.getMessageString("SELECTOCP")+"  "+p1;
                //s1=3D"OCP  "+p1;
                else
                s1=3DbuttonRa.getMessageString("SELECTOCP")+p1;
                //s1=3D"OCP"+p1;
                %>
                <input type=3D"submit" name=3D"action" value=3D"<%=3D s1 =
%>">

            </td>
          </tr>
       <% }

        if(tmpline!=3Dnull){
        for (int k =3D 0; k < tmpline.length; ++k) { %>
        <INPUT TYPE=3D"hidden" NAME=3D"terminalCodeList" VALUE=3D"<%=3D =
tmpline[k] !=3D null ? tmpline[k]:"" %>">

    		<% }
    } 	 %>

        </table>
    </td>
  </tr>
  <tr class=3D"BTN">
    <td >
      <div align=3D"center">
        <input type=3D"submit" name=3D"<%=3DVSSConstant.INSERTROW%>" =
value=3D"<%=3DbuttonRa.getMessageString("INSERTROW")%>">
        <input type=3D"submit" name=3D"<%=3DVSSConstant.APPENDROW%>" =
value=3D"<%=3DbuttonRa.getMessageString("APPENDROW")%>">
        <input type=3D"submit" name=3D"<%=3DVSSConstant.DELETEROW%>" =
value=3D"<%=3DbuttonRa.getMessageString("DELETEROW")%>">
      </div>
    </td>
  </tr>
  <tr class=3D"BTN">
    <td >
        <div align=3D"center">
        <input type=3D"submit" style=3D"background:#CEDDF4;" =
name=3D"<%=3DVSSConstant.SUBMIT%>" =
value=3D"<%=3DbuttonRa.getMessageString("SUBMIT")%>">
        <input type=3D"submit" style=3D"background:#CEDDF4;" =
name=3D"<%=3DVSSConstant.CANCEL%>" =
value=3D"<%=3DbuttonRa.getMessageString("CANCEL")%>">

        </div>
    </td>
  </tr>
</table>
</form>
</body>
</html>

------=_NextPart_000_006B_01C43CFB.CF976580--