betweenGo

JSP redirect to another page

by on Jun.10, 2008, under JSP

I found on this forum how to redirect to another page in JSP. One of the respondents explained it perfectly.

Well you have two options. Either you’ll do a server side forward or a client side redirect.
Server side forward has no interaction with the browser and therefore the URL on the location bar won’t change.
But if you do the HTTP redirect, the browser is instructed to load the other page and the contents of the location will change.
It’s your call which one to choose.

forward:

<% if (s1.equals(s2) ) { %>

     <jsp:forward page="s2.jsp"/>

<% } %>

redirect:

<% if (s1.equals(s2) ) {

    response.sendRedirect("s2.jsp");

} %>


Share

Related posts:

  1. Testing Which Page Loaded your JSP Page Fragment
  2. Size of collection in a JSP/DSP page
  3. Trim White Space from JSP
  4. ATG Log Error from JSP Page
  5. Jumping to different parts of a page using a dropdown

:,

Leave a Reply

 

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!