This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
response.sendRedirect() method is used to just redirect the request. By this method the request variables will not be available in the forwarded page. Where as for request despatching they will be available. Suppose u have a HTML text field by the name 'name'.Suppose the form's action page is a servlet 'A'. After the form is submitted, in servlet 'A', u can access the value entered in the text field by using request.getParameter("name"). Suppose u have redirected the request from 'A' to servlet 'B'. In 'B' u cannot access the parameter "name" as u did in servlet 'A'. U can access it only if u had despatched it. When u use sendRedirect(), the response is committed to the browser and it is the browser which calls the second servlet.
Joined: Nov 22, 2008
Does it has any thing to do with the Application context.If no, then What if i want to forward or redirect some request to a jsp/servlet of another context.
"Nirant", We're pleased to have you here with us in the JSP forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it. In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. Thanks! bear Forum Bartender
TV KUMAR, JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of. I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations. thanks, bear JSP Forum Bartender