473,387 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

jsp forwarding request to another jsp

17
I have a jsp CustomerLogin.jsp which takes customerid and a servlet forwarding request object to another jsp records.jsp.

In this records.jsp i have a button calling another jsp Customer.jsp.I want request object i.e customerid here.How can i get that.Using request dispatcher displays both records.jsp and customer.jap in same page.I dont want that

Pls help..
Oct 6 '06 #1
5 4064
r035198x
13,262 8TB
I have a jsp CustomerLogin.jsp which takes customerid and a servlet forwarding request object to another jsp records.jsp.

In this records.jsp i have a button calling another jsp Customer.jsp.I want request object i.e customerid here.How can i get that.Using request dispatcher displays both records.jsp and customer.jap in same page.I dont want that

Pls help..
Assuming you get the id in the servlet using
String customerI = request.getParameter("id");

in the servlet do request.setAttribute("id", customerId);
then request.getRequestDispatcher("/records.jsp").include(request, response);


in records.jsp do
request.getAttribute("id").toString();
Oct 6 '06 #2
shreya
17
Assuming you get the id in the servlet using
String customerI = request.getParameter("id");

in the servlet do request.setAttribute("id", customerId);
then request.getRequestDispatcher("/records.jsp").include(request, response);


in records.jsp do
request.getAttribute("id").toString();
Thanks for the response.But i need customer id in customer.jsp which is called by records.jsp.

I can get id in records.jsp but when i use requestDispatcher in this jsp to fwd object to customer.jsp i can see both pages Records.jsp and customer.jsp

I want id to be fwd to Customer.jsp and when i click on button in records.jsp and i should see Customer.jsp.

Could you pls tell me the solution
Oct 6 '06 #3
r035198x
13,262 8TB
Thanks for the response.But i need customer id in customer.jsp which is called by records.jsp.

I can get id in records.jsp but when i use requestDispatcher in this jsp to fwd object to customer.jsp i can see both pages Records.jsp and customer.jsp

I want id to be fwd to Customer.jsp and when i click on button in records.jsp and i should see Customer.jsp.

Could you pls tell me the solution
in the jsp do not use request dispatcher. Instead put the path of Customer.jsp as the action path for the form with the submit button.
You pass the id as a hidden input field.

Expand|Select|Wrap|Line Numbers
  1. <FORM name="form1" method="post" action="/customer.jsp"><B> 
  2.      <INPUT type="hidden" name="id" value="<%=myID">              
  3.     <INPUT type="submit" name="submit" value="Go to Customer">
  4. </FORM>
In customer.jsp you can get the id using request.getParameter("id");
Oct 6 '06 #4
shreya
17
in the jsp do not use request dispatcher. Instead put the path of Customer.jsp as the action path for the form with the submit button.
You pass the id as a hidden input field.

Expand|Select|Wrap|Line Numbers
  1. <FORM name="form1" method="post" action="/customer.jsp"><B> 
  2.      <INPUT type="hidden" name="id" value="<%=myID">              
  3.     <INPUT type="submit" name="submit" value="Go to Customer">
  4. </FORM>
In customer.jsp you can get the id using request.getParameter("id");
Thanks for your help.I did that
Oct 9 '06 #5
r035198x
13,262 8TB
Thanks for your help.I did that
Glad to help.

God bless
Oct 9 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Howard Kelley | last post by:
What is the HTML code for forwarding one page to another? I recall there is a meta statement that can used. In other words, I want browser inquiries to http://xxx.xx to go immediately to...
6
by: Agoston Bejo | last post by:
Hi. x1.asp: <form method="post" action="x2.asp"> .... </form> x2.asp: DoSomeAdministration() Response.Redirect "x3.asp?" & Request.Form x3.asp: further processsing of data
6
by: cyrus | last post by:
Does anyone know how to implement a class that can forward a port to another pc? It should for example when a http request on a port arrives on the pc where the program is running forward the...
5
by: Brian Henry | last post by:
I want to be able to forward any request from my one site to another site based on the IP address... kind of like denying access to the site if an IP is a certain one if they try to access any page...
1
by: google | last post by:
I'm building a small ASPX page in C# to forward HTTP POST requests to another site. When the other site returns an HTTP error such as 404 or 405, I want to return that same HTTP status value to my...
4
by: andrew | last post by:
Hi there everyone. Right I have scoured everywhere to find out how to do this and I haven't the foggiest... I am building a shopping cart that uses an external clearing house . My shopping...
1
by: thomas | last post by:
Hello all, It seems like subdomain forwarding prevents ASP.Net session state from working correctly. Example: two websites http://www.jgphotographers.com/test and...
6
by: mcl | last post by:
I have a domain name which is set up for web forwarding with a frame. I have a link on one of the site's pages to an external site. When I select the link the external site is displayed correctly...
2
dmjpro
by: dmjpro | last post by:
I am forwarding the error page using error-page tag in web.xml. If i want to pass some parameters with error_page .....My Code is somthing like that <error-page>...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.