Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2005
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to display value in textbox

    I have a form, 1st page called first.jsp. in this form I have multiple fields. once user enters the first field, I call to the second.jsp to process by using 'onchange="location.href='second.jsp?first_field='+this.value"'

    in second.jsp, it will get the value for 2nd field and return to first.jsp. I manage to get the value returned to first.jsp but not able to display in the second field textbox.

    how do I do it

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,990
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    Please show us your code, otherwise is is pretty well impossible to respond sensibly.

  • #3
    New Coder
    Join Date
    Aug 2005
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    as requested, the following is part of the coding

    part of the coding - first.jsp
    ---------------------------
    <%
    String itemDesc = (String) request.getAttribute("materialDesc") ;
    if( itemDesc != null){
    System.out.println("aaa " +itemDesc);
    %>
    <%}%>

    <html>
    ....
    <body>
    <%
    int i;
    for (i=1;i<=15;i++) {%>

    <tr>
    <td width="3%"><center><%=i%></center></td>
    <td width="15%">
    <input type="text" name="item_num<%=i%>" style="width:100%;text-align:left;" maxlength=15
    onChange="location.href='second.jsp?in_num='+this.value, this.form.materialDesc<%=i%>.value=<%=itemDesc%>, openRow(<%=i%>);">
    </td>

    <td width="19%">
    <input type="text" name="materialDesc<%=i%>" style="width:100%" value="" disabled>
    </td>

    second.jsp
    ----------
    <%@page import="java.sql.*,java.lang.Object,java.lang.String,java.lang.*,java.util.*,java.text.SimpleDateFor mat, java.text.*"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    <jsp:useBean id = "trx" class="trx.TransDetails" scope="request" />

    <% String in_num = request.getParameter("in_num");
    String materialDesc = trx.getItem(in_num); //now a getter
    request.setAttribute("materialDesc" , materialDesc ) ;
    RequestDispatcher rd = request.getRequestDispatcher("transaction_main.jsp") ;
    rd.forward(request, response) ;
    %>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •