How do I populate information from aspx form to jsp page?
Hi everyone,
I have a form in .aspx and wants to populate the information from aspx form to the jsp page. I'm not really sure to approach this or calling it in jsp page, can someone help me out, Thanks and here is an example of 2 forms
In Form1.aspx:
<input name="TxtStreetNumber" type="text" id="TxtStreetNumber"
><input name="TxtStreetName" type="text" id="TxtStreetName"
><input name="TxtCity" type="text" id="TxtCity"
><input name="TxtState" type="text" id="TxtState"
><input name="TxtZipCode" type="text" id="TxtZipCode"
The Submit button from Form1.aspx to "Addressform.jsp" is calling by this url configure in web.Config http://localhost:8080/webmap/SearchServlet and here is the connection and along with address information wants to populate in jsp page.
Response.Redirect(ConfigurationSettings.AppSettings.Get("MapInforWebPath") + "?StreetNumber=" + TxtStreetNumber.Text + "&StreetName=" + TxtStreetName.Text + "&StreetType=" + DropListStreetType.SelectedItem.Text+"&City=" + TxtCity.Text + "&State=" + TxtState.Text + "&ZipCode=" + TxtZipCode.Text);
So how do I call from Form1.aspx and put values in AddressForm.jsp page where the VALUES are
<INPUT TYPE="TEXT" NAME="<%=FirstSearchConstants.FF_STREETNUMBER%>" ID="streetnumber" VALUE="<%=streetnumber%>"
><INPUT TYPE="TEXT" NAME="<%=FirstSearchConstants.FF_STREETNAME%>" ID="streetname" VALUE="<%=streetname%>"
><SELECT NAME="<%=FirstSearchConstants.FF_STREETTYPE%>" ID ="streettype" OPTION value="<%=streettype%>"><%=streettype%></OPTION>
<INPUT TYPE="TEXT" NAME="<%=FirstSearchConstants.FF_CITY%>" ID="city" VALUE="<%=city%>"
><INPUT TYPE="TEXT" NAME="<%=FirstSearchConstants.FF_ZIP%>" ID="zip" VALUE="<%=zip%>">
[1888 byte] By [
bcbg22a] at [2007-11-27 11:00:41]

First off all watch your asp form send the fields in Title case whereas you have called the jsp variable in lower case
Your ASP:
Get("MapInforWebPath") + "?StreetNumber=" + TxtStreetNumber.Text + "&
Your JSP:
VALUE="<%=streetnumber%>"
A small hint to read the posted information in JSP
<%
String login = request.getParameter("login");
%>
Your code can be changed to have the request object like below
VALUE="<%=request.getParameter('StreetNumber')%>"
Hope it makes sense
Good Luck
Ranjith
Thanks ranjith98 for replying, really appreciate! :-)
So in address.aspx button called
Response.Redirect(ConfigurationSettings.AppSettings.Get("MapInforWebPath") + "?StreetNumber=" + TxtStreetNumber.Text + "&StreetName=" + TxtStreetName.Text + "&StreetType=" + DropListStreetType.SelectedItem.Text+"&City=" + TxtCity.Text + "&State=" + TxtState.Text + "&ZipCode=" + TxtZipCode.Text);
And in AddressForm.jsp calls the address.aspx form and place values in corresponding to where jsp VALUEs are, but when you request the .aspx form, don't you have to add the form extension in where the "address" is like String address = request.getParameter("address.aspx");
<% instead of
String address = request.getParameter("address");
%>
VALUE="<%=request.getParameter('StreetNumber')%>"
VALUE="<%=request.getParameter('StreetName')%>"
VALUE="<%=request.getParameter('StreetType')%>"
VALUE="<%=request.getParameter('State')%>"
VALUE="<%=request.getParameter('ZipCode)%>"
Again thankyou for your help,
Ok
I am bit confused now ...
Ur intitial argument was you have a ASP form that calls a JSP form on an event right?
if this is the case you dont have to mention the aspx to JSP,
I am assuming you are posting data via URL (POST/GET) abd by using request.getParameter(...) you can read the name/values from URL
Hope I make sense
Ranjith
> Thanks ranjith98 for replying, really appreciate!
> :-)
>
> So in address.aspx button called
>
> Response.Redirect(ConfigurationSettings.AppSettings.Ge
> t("MapInforWebPath") + "?StreetNumber=" +
> TxtStreetNumber.Text + "&StreetName=" +
> TxtStreetName.Text + "&StreetType=" +
> DropListStreetType.SelectedItem.Text+"&City=" +
> TxtCity.Text + "&State=" + TxtState.Text +
> "&ZipCode=" + TxtZipCode.Text);
>
> And in AddressForm.jsp calls the
> address.aspx form and place values in
> corresponding to where jsp VALUEs are, but when you
> request the .aspx form, don't you have to add the
> form extension in where the "address" is like
> String address =
> request.getParameter("address.aspx");
> <% instead of
>
> String address = request.getParameter("address");
> %>
>
> VALUE="<%=request.getParameter('StreetNumber')%>"
> VALUE="<%=request.getParameter('StreetName')%>"
> VALUE="<%=request.getParameter('StreetType')%>"
> VALUE="<%=request.getParameter('State')%>"
> VALUE="<%=request.getParameter('ZipCode)%>"
>
> Again thankyou for your help,
Yes
> Ok
> I am bit confused now ...
>
> Ur intitial argument was you have a ASP form that
> calls a JSP form on an event right?
Yes, I'm calling from ASP form to JSP form by the URL link http://localhost:8080/form/SearchServlet and wants to populate address information from ASP to JSP
> if this is the case you dont have to mention the aspx
> to JSP,
>
> I am assuming you are posting data via URL (POST/GET)
> abd by using request.getParameter(...) you can read
> the name/values from URL
So if that's the case, I don't need to add .aspx in right? like <%String address = request.getParameter("address")%> , I just want to clarify it, I'm new to Java and also JSP and still find my way around hihi, sorry to confuse you, another question, will the dropdown list from JSP form match up with the ASP dropdown list? in another word, if I select US from ASP list, will it match up the list in JSP and shows in the box US or do I have to create some sort of statement for selection matchup?
%
Yes you got the point now
G Luck
Thanks ranjith98 for all your help, really appreciate :-) , now I could populate information to the JSP form but still couldn't get the "streettype" and "state" values to match up from the dropdownlist option in JSP form, I place the VALUE="<%=request.getParameter("StreetType")%>" where the Streettype Option in JSP but still doesn't work, I'm not sure that you have to create a function call in JSP to match up the values from the ASP form or not and I'm not really sure how to approach that, can you give me some hint or some code example? again thanks for your help....