Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8306435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:19:49+00:00 2026-06-08T18:19:49+00:00

I have some problems with redirection in jsp app. My redirect method is like

  • 0

I have some problems with redirection in jsp app.

My redirect method is like this:

public static void redirectUrl(String url,HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException
{
    request.getSession().getServletContext().getRequestDispatcher("/" + url).forward(request,response);
}

When I start the app on localhost everything works fine but when I deployed it on the server it crash with this exception:

Servlet error
java.lang.IllegalStateException: Response has already been committed
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.EvermindHttpServletResponse.resetBuffer(EvermindHttpServletResponse.java:1933)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:221)
at app.framework.request.Controller.doPost(Controller.java:50)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:835)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:341)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:230)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.GetParametersRequestDispatcher.forward(GetParametersRequestDispatcher.java:257)

I put return statement after every redirect call but it won’t work.

Can someone tell me why?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:19:49+00:00Added an answer on June 8, 2026 at 6:19 pm
    java.lang.IllegalStateException: Response has already been committed
    

    This error comes when response has already written.

    See the answer in this post.

    The term redirecting” you are using is not redirect as per your code.Its called “forwarding”.

    Try:

    request.getRequestDispatcher("/" + url).forward(request, response);
    

    EDIT (DetailedExplanation) :

    request.getRequestDispatcher(“url”) means the dispatch is relative to the current HTTP request.

    RequestDispatcher reqDispObj = request.getRequestDispatcher("/home.jsp");
    

    The path parameter doesn’t have to start with a “/”

    getServletContext().getRequestDispatcher(“url”) means the dispatch is relative to the root of the ServletContext.

    RequestDispatcher reqDispObj = getServletContext().getRequestDispatcher("/ContextRoot/home.jsp");
    

    The path parameter has to start with a “/”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have some problems with rowspan: var doc1 = new Document(); doc1.SetPageSize(PageSize.A4.Rotate()); string path
I Have some problems with redirecting to another URL based on the query string
I am struggling to achieve this simple thing... I have some static pages which
i have some problems with a Query seem IN dosen't work with Group_concat, that
I have some problems with Javascript. In fact, I'm just newbie in that script
I have some problems with header() function. It works and doesn't work at the
I have some problems with my first Open Graph custom action: I've created a
I have some problems sending mails through SMTP using Spring's MailSender interface and the
I have some problems with OpenCV s cvCanny(...) and the Image data types it
I have some problems sending an id though jquery. I have a form select

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.