You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by engp0510 <en...@nus.edu.sg> on 2003/09/04 09:59:34 UTC

How to cache the user's input in a jsp page?

Hi
How to cache the user's input in a jsp page? The following is some code of my JSP:

<%
   int item_num = 5;
   int row_num  = 1;
   if(request.getParameter("row_num")!=null){
      String rowstr = (request.getParameter("row_num"));
      try{
         row_num = Integer.parseInt(rowstr);        
      }
      catch(NumberFormatException ne){}
   }
%>
...................
...................
        <TR class="LGREY">
          <TD class="L" align=right width="25%"  >Subject&nbsp; : </TD>
          <TD class="L" width="75%"  >&nbsp;
              <INPUT tabIndex=1 maxLength=100 size=40 name=subject> 
          </TD> 
        </TR>


..................
              <select size="1" name=item_num ONCHANGE="location=this.options[this.selectedIndex].value;">
               <%for(int i=1;i<=5;i++){%>
               <option value="\AddQuotation.jsp?actionfrom=<%=request_from%>&row_num=<%=i%>"<%if(row_num==i){out.print("SELECTED");}%> >-<%=i%>-</option>
               <%}%>
                </select>
....................
...................
           <%for(int ii=0;ii<row_num;ii++){%>
            <tr>
              <td width="25%" align="center"  ><%=ii+1%></td>
              <td width="25%" align="center"  >
                  &nbsp;<INPUT tabIndex=2 maxLength=100 size=25 name=project_detail_<%=ii+1%>></td>
              <td width="25%" align="center"  >
                  &nbsp;<INPUT tabIndex=2 maxLength=20 size=10 name=quantity_<%=ii+1%>></td>
              <td width="25%" align="center" >
                  &nbsp;<INPUT tabIndex=2 maxLength=20 size=10 name=unit_price_<%=ii+1%>></td>
            </tr>     
            
           <%}%>     

The choosing of select will refresh this jsp and create the rows as many as choosed. But how to cache the input of "Subject"?

???? email:       <INPUT NAME="email" onChange="checkEmail(this.value)"><BR>

Can I do this without using javascript?

Re: How to cache the user's input in a jsp page?

Posted by Mario Moroni <mo...@email.it>.
You can put them on
session object, or wrtite them on a database , or also rewrtite them in the
new page in hidden fields...

It depends on what you want to do with those datas.

 Mario

----- Original Message ----- 
From: "engp0510" <en...@nus.edu.sg>
To: <to...@jakarta.apache.org>; <ja...@lists.mysql.com>
Sent: Thursday, September 04, 2003 9:59 AM
Subject: How to cache the user's input in a jsp page?


Hi
How to cache the user's input in a jsp page? The following is some code of
my JSP:

<%
   int item_num = 5;
   int row_num  = 1;
   if(request.getParameter("row_num")!=null){
      String rowstr = (request.getParameter("row_num"));
      try{
         row_num = Integer.parseInt(rowstr);
      }
      catch(NumberFormatException ne){}
   }
%>
...................
...................
        <TR class="LGREY">
          <TD class="L" align=right width="25%"  >Subject&nbsp; : </TD>
          <TD class="L" width="75%"  >&nbsp;
              <INPUT tabIndex=1 maxLength=100 size=40 name=subject>
          </TD>
        </TR>


..................
              <select size="1" name=item_num
ONCHANGE="location=this.options[this.selectedIndex].value;">
               <%for(int i=1;i<=5;i++){%>
               <option
value="\AddQuotation.jsp?actionfrom=<%=request_from%>&row_num=<%=i%>"<%if(ro
w_num==i){out.print("SELECTED");}%> >-<%=i%>-</option>
               <%}%>
                </select>
....................
...................
           <%for(int ii=0;ii<row_num;ii++){%>
            <tr>
              <td width="25%" align="center"  ><%=ii+1%></td>
              <td width="25%" align="center"  >
                  &nbsp;<INPUT tabIndex=2 maxLength=100 size=25
name=project_detail_<%=ii+1%>></td>
              <td width="25%" align="center"  >
                  &nbsp;<INPUT tabIndex=2 maxLength=20 size=10
name=quantity_<%=ii+1%>></td>
              <td width="25%" align="center" >
                  &nbsp;<INPUT tabIndex=2 maxLength=20 size=10
name=unit_price_<%=ii+1%>></td>
            </tr>

           <%}%>

The choosing of select will refresh this jsp and create the rows as many as
choosed. But how to cache the input of "Subject"?

???? email:       <INPUT NAME="email" onChange="checkEmail(this.value)"><BR>

Can I do this without using javascript?



--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f

Sponsor:
Se cerchi personale qualificato per la tua società entra in StepStone!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=1711&d=4-9