gkottapalli@Y
AHOO.COM To: [EMAIL PROTECTED]
cc:
06/13/00 Subject: Re: request.getParameter("..")
not working ???....help me
12:37 PM please !!
Please
respond to
JSP-INTEREST
Hi,
change Form1.jsp like this....
<%@ page language="java"%>
<HTML><HEAD><TITLE>Form1</TITLE>
<script language="JavaScript">
function submitInfo() {
document.frm1.method="post";
document.frm1.plantId.value = 100;
document.frm1.plantName.value = "Wxyz";
document.frm1.action = "Form2.jsp";
document.frm1.submit();
return;
}
</script></HEAD>
<BODY><CENTER><H4> Test </H4> <BR><BR>
<%! int maxId=50;
String path="Form2.jsp?plantId=" + maxId +
"&plantName=wxyz";
%>
<FORM name="frm1">
<!-- <Input type="text" name="plantId">
<Input type="text" name="plantName"> <BR><BR><BR> -->
<Input type="Button" name="btnSend" value="Submit"
onClick="submitInfo();">
<input type = hidden name = plantId>
<input type= hidden name=plantName>
</CENTER></FORM></BODY>
</HTML>
This code will work.. In your code you have set form method as post and you
are setting the querystring
for post method we can't set the query string. post method uses seperate
socket connection to pass the querystring
and we can't see the query sting in the url box.
thanks,,
sridhar boddula
Very sorry for the typo.I used the same case while
requesting and while sending.Here is my exact code for
the two forms, Form1.jsp and Form2.jsp.
Form1.jsp :
<%@ page language="java"%>
<HTML><HEAD><TITLE>Form1</TITLE>
<script language="JavaScript">
function submitInfo() {
document.frm1.method="post";
document.frm1.action="Form2.jsp?plantId=100&plantName=wxyz";
document.frm1.submit();
return;
}
</script></HEAD>
<BODY><CENTER><H4> Test </H4> <BR><BR>
<%! int maxId=50;
String path="Form2.jsp?plantId=" + maxId +
"&plantName=wxyz";
%>
<FORM name="frm1">
<!-- <Input type="text" name="plantId">
<Input type="text" name
="plantName"> <BR><BR><BR> -->
<Input type="Button" name="btnSend" value="Submit"
onClick="submitInfo();">
</CENTER></FORM></BODY>
</HTML>
Form2.jsp :
<%@ page language="java"%>
<HTML>
<HEAD>
<TITLE>Plant List</TITLE>
</HEAD>
<BODY>
<CENTER> <H4> Test </H4> <BR><BR>
QueryString : <%= request.getQueryString()%> <BR>
PLantID: <%= request.getParameter("plantId")%>
<BR>
PLantName: <%= request.getParameter("plantName")%>
<BR>
</CENTER>
</BODY>
</HTML>
Thanks,
Geeta
Here
--- Geeta Kottapalli <[EMAIL PROTECTED]> wrote:
> Having problem with request.getParameter("plantID")
> which shows null
> when submiting the info as part of query string i.e,
> <form name="frm1" method="post"
> action="Form2.jsp?plantId=50&plantName=wxyz">
> or in a JavaScript function as
> document.frm1.method ="post";
>
>
document.frm1.action="Form2.jsp?plantId=50&plantName=wxyz";
> document.frm1.submit();
>
> When info from Form1.jsp is sent thru query string
> to
> Form2.jsp, in the page
> location
> I can see the url same as query
>
string(http://..../Form2.jsp?plantId=50&plantName=wxyz)
> but when I use request.getParameter("..") to
> retrieve
> values it shows null
> values.
> Even request.getQueryString() works fine.
>
> Does anyone know why this is happenning??
> I am using JWS2.0 with jdk1.2.2 on Windows NT4.0
> workstation.
>
> The following is the script for Form1.jsp and
> Form2.jsp and if it needs any
> corrections
> or suggestions please let me know.I appreciate your
> help.
>
> Form1.jsp :
>
> <%@ page language="java"%>
>
>
> // -->
> Test
>
>
>
> onClick="submitInfo();">
>
>
> Form2.jsp :
>
> <%@ page language="java"%>
>
>
> Test
>
>
> ueryString :
> PLantID:
> PLantName:
>
>
>
> Thanks,
> Geeta
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Photos -- now, 100 FREE prints!
> http://photos.yahoo.com
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
__________________________________________________
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
http://photos.yahoo.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets