getting price from 1 page to another page
ok i have a shopping cart jsp page which displays the price in the textbox.
<input type="text" name="textfield" size="10" disabled value=" <%=sum%>" />
i want this price to be displayed in another jsp page.
how do i do it?
[359 byte] By [
anya_aaa] at [2007-11-27 3:56:37]

# 1
Do you mean on submitting the page?
In that case on the receiving JSP you'd write:
String receivedPrice = request.getParameter("textfield");
if ( receivedPrice == null || receivedPrice.length() == 0 )
throw new Exception ("Price value was not submitted");
But your code
<input type="text" name="textfield" size="10" disabled value=" <%=sum%>" />
will not work because as far as I know, disabled fields are not submitted with the form. You should make the field read-only to prevent the user from changing it but still be able to send the data on submit. I.e.
<input type="text" name="textfield" size="10" readonly="readonly" value=" <%=sum%>" />
# 4
Then on your form.jsp you should either receive the parameter into a readonly textfield, to display to the user, or as a hidden field to keep in the form but not display:
<input type="text" name="textfield" value="<%=request.getParameter("textfield")%>" readonly="readonly" />
OR
<input type="hidden" name="textfield" value="<%=request.getParameter("textfield")%>" readonly="readonly" />
Then, on your confirm.jsp, you'l again be able to receive the value with request.getParameter("textfield").