View Full Version : how to display value in textbox

10-21-2005, 08:12 AM
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

Philip M
10-21-2005, 08:40 AM
Please show us your code, otherwise is is pretty well impossible to respond sensibly.

10-21-2005, 08:54 AM
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);

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

<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 width="19%">
<input type="text" name="materialDesc<%=i%>" style="width:100%" value="" disabled>

<%@page import="java.sql.*,java.lang.Object,java.lang.String,java.lang.*,java.util.*,java.text.SimpleDateFormat, java.text.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<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) ;