title: JSP redirect to different URL
body: <p>In my application, user can subscribe to different clubs like for example Kid club, Youth club, Adult club and Elderly club. Now, suppose if user is already subscribed to Kid club on 7th October 2012 and if he again tries to subscribe the same club "Kid Club" on 2nd November 2012 then we try to redirect that user to another club such as Youth Club OR Adult Club OR Elderly Club. Each club has it's own domain such as (For example)</p>
  
  <pre><code>Kid club = kidclub.google.mobi
  Youth Club = youthclub.yahoo.mobi
  Adult Club=adult.godaddy.mobi
  Elderly Club = elderly.google.mobi
  </code></pre>
  
  <p>Following is the sample code for redirection but this is not redirecting to different domain URL. Is it due to sendRedirect () method?Servlet is not used in this application. Only JSP is used with MySQL database in Apache Tomcat Server Please suggest asap. </p>
  
  <pre><code> void doRedirect(HttpServletResponse response, String url)
      {
      try 
      {
      response.sendRedirect(url);
      }
      catch (Exception e) 
      {
      e.printStackTrace()
      }
      }
  
      void redirectReturningUser( HttpServletRequest request, HttpServletResponse
      response, ClubDomain currentDomain )
      {
      String redirectToUrl = currentDomain.getDefaultUrl();
  
      if( "kidclub.google.mobi".equals( currentDomain.getDefaultUrl() ) )
      redirectToUrl = "youthclub.yahoo.mobi";
      else if( "adult.godaddy.mobi".equals( currentDomain.getDefaultUrl() ) )
      redirectToUrl = "kidclub.google.mobi";
      else if( "youthclub.yahoo.mobi".equals( currentDomain.getDefaultUrl() ) )
      redirectToUrl = "adult.godaddy.mobi";
      else if( "adult.godaddy.mobi".equals( currentDomain.getDefaultUrl() ) )
      redirectToUrl = "elderly.google.mobi";
      else if( "elderly.google.mobi".equals( currentDomain.getDefaultUrl() ) )
      redirectToUrl = "adult.godaddy.mobi";
  
      doRedirect(response, "http://"+redirectToUrl );
      }
  </code></pre>
  
  <p>Thanks in advance</p>