GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  JSP
Go To First  |  Previous Question  |  Next Question 
 JSP  |  Question 25 of 306    Print  
How do I perform browser redirection from a JSP page?
You can use the response implicit object to redirect the browser to a different resource, as:
response.sendRedirect("http://www.exforsys.com/path/error.html");
You can also physically alter the Location HTTP header attribute, as shown below:
<%
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
String newLocn = "/newpath/index.html";
response.setHeader("Location",newLocn);
%>
You can also use the: <jsp:forward page="/newpage.jsp" /> Also note that you can only use this before any output has been sent to the client. I beleve this is the case with the response.sendRedirect() method as well. If you want to pass any paramateres then you can pass using <jsp:forward page="/servlet/login"> <jsp:param name="username" value="jsmith" /> </jsp:forward>>



  
Total Answers and Comments: 0 Last Update: N/A   
  
 Sponsored Links

 

No answers are posted for this question yet.
Be the first to answer it!


 Related Questions

Latest Answer : hi, We Can restrict page errors by using the two attributes of page directive i.e. error attribute set to true and then use the errorPage attributes that specifies the url of Error page.Thanks ...

Latest Answer : Hi guysthere are 3 ways to do this1) 2) response.sendredirect3)  forward methos of requestdispatcher ...

How do I have the JSP-generated servlet subclass my own custom servlet class, instead of the default?
One should be very careful when having JSP pages extend custom servlet classes as opposed to the default one generated by the JSP engine. In doing so, you may lose out on any advanced optimization that 

The following code snippet shows how a servlet instantiates a bean and initializes it with FORM data posted by a browser. The bean is then placed into the request, and the call is then forwarded to the 
Latest Answer : Hi Jose Kutty,Mr. Nanda is wrong. We can create RequestDespatcher object by two ways, either  by ServletRequest object       request.getRequestDispatcher("/abc.jsp");// here you need to mention relative path(or) ...

A cookie, mycookie, can be deleted using the following scriptlet: 
Latest Answer :  In First line, We are creating cookie object of cookie class,after that we are sending response to server.we make object which take null value and it, setting life 0, after that we cookie send token to server, with null value, and max age 0.then cookie ...

You can declare methods for use within your JSP page as declarations. The methods can then be invoked within any other methods you declare, or within JSP scriptlets and expressions.Do note that you do 

We know that session tracking uses cookies by default to associate a session identifier with a unique user. If the browser does not support cookies, or if cookies are disabled, you can still enable session 

You can use the errorPage attribute of the page directive to have uncaught runtime exceptions automatically forwarded to an error processing page. For example:redirects 
Latest Answer : Alternatively u can get Servletcontext and use the log file to push the errors to the log file.. ...

You will need to set the appropriate HTTP header attributes to prevent the dynamic content output by the JSP page from being cached by the browser. Just execute the following scriptlet at the beginning 

You can use "JSP-style" comments to selectively block out code while debugging or simply to comment your scriptlets. JSP comments are not visible at the client.For example: 
Latest Answer : There are two types of comments in JSP1.Output Comment:   If we use this comment ,the code will be seen in the viewable page source2.Hidden Comment:   If we use this ...


 Sponsored Links

 
Related Articles

jQuery - Marking the Current Page

Learning jQuery Marking the Current Page Our pager can be made more user friendly by highlighting the current page number We just need to update the classes on the buttons every time one is clicked mosgoogle geshibot lang php&quot; var pager ; for var page 0; page numPages; page pag
 

The Interview Snafu

How to turn someone else&rsquo;s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won&rsquo;t get over the line without a polished, prof
 

JavaScript Browser Objects Part 2

JavaScript Browser Objects Part 2 In this JavaScript tutorial you will learn about Browser Objects viz button object properties of button object form name value Methods of button object checkbox object properties of checkbox object checked defaultChecked form name type value Methods of checkbox obje
 

JavaScript Browser Objects

JavaScript Browser Objects In this JavaScript tutorial you will learn about browser objects in JavaScript categories of browser based objects additional browser objects anchor object link object properties of link object and methods of link object mosgoogle center JavaScript supports a number of bro
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

JSP Page Directive

JSP Page Directive In this JSP tutorial you will learn about JSP page directive attributes of the page directive along with syntax examples and explanations mosgoogle autoFlush autoFlush&nbsp; attribute is used to specify whether or not to automatically flush out the output buffer when it is ful
 

How to use JavaScript in HTML page

How to use JavaScript in HTML page In this JavaScript tutorial you will learn how to use JavaScript in HTML page how to write output to a page different places where JavaScript can be paced in HTML JavaScript in external file and how to place and execute JavaScript in external file mosgoogle How to
 

HR Interview - HR Interview Mistakes You Will Want To Avoid

HR Interview Mistakes You Will Want To Avoid The job interview can be a stressful process This is especially true for those who are going after a competitive position Your nonverbal communication combined with the answers you give during the interview will determine if you are hired mosgoogle While
 

HR Interview - Behavioral HR Interviews

Behavioral HR Interviews As the name implies a behavioral interview is an interview that is held by a human resources department to determine if an applicant has the behaviors that are appropriate for a job The company must know how an applicant will behave in a certain situations mosgoogle The logi
 





About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape