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 7691845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:42:59+00:00 2026-05-31T20:42:59+00:00

I have a .jsp file that receives a request and checks the request’s parameters.

  • 0

I have a .jsp file that receives a request and checks the request’s parameters. Within the same directory as this JSP file, there is error.jsp file that is supposed to do error processing. If the parameters are null I want to forward the request to error.jsp file as in:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="ISO-8859-1"%>

<html>
  <head></head>
<body></body>
<% 
request.setCharacterEncoding("UTF-8");
String uid = request.getParameter("uid");
String procName = request.getParameter("procName");
//param check
if(uid == null || procName == null){ %>
<jsp:forward page="error.jsp"/> 
<% }%>
</html>

However, this does not work. After the forward line I have the request re-submitted to the same JSP instead of error.jsp. Eventually, I get a StackOverflowException due to the cycle at the server.

If instead of JSP:forward, I use response.sendRedirect() as in:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="ISO-8859-1"%>
<html>
<head></head>
<body></body>
<% 
request.setCharacterEncoding("UTF-8");
String uid = request.getParameter("uid");
String procName = request.getParameter("procName");

//param check
if(uid == null || procName == null){
response.sendRedirect("error.jsp");
}%>
</html>

everything works fine. Why does the jsp:forward fail to work? According to this site and the API I have the correct tags in place.

PS.: The JSPs are deployed in a JBoss AS with version 4.0.5 GA.

  • 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-05-31T20:43:00+00:00Added an answer on May 31, 2026 at 8:43 pm

    Read the stacktrace of the StackOverflowError and pay attention to the repeating pattern. Check if there isn’t any custom Filter been involved which is repeatedly intercepting on the forwarded request and fix the Filter‘s code or configuration accordingly so that it isn’t doing that anymore. For example, remove <dispatcher>FORWARD</dispatcher> from the configuration or set some request attribute which indicates that the Filter has already done the job.

    Last but not least, you should actually not be using a JSP file as a front controller, but a servlet. For new insights you may find the examples in our servlets wiki page helpful. It also covers basic validation and error handling.

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

Sidebar

Related Questions

let's say i have a servlet that forwards a request to a jsp file
I have a JSP file that contains lots of if statements. Is there a
Suppose I have a JSP file that contains a tag (hence a .tag file).
I have a .csv file that needs to be read for my jsp. I
I have created a simple JSP file that I want to deploy in Jetty
lets say i have an xml file path.xml that goes like this: <paths> <path
I have list of images in my jsp file that i want to display
I have a webapp in Tomcat with a main JSP file that includes another
I have a jsp file that generates some files at runtime, which are also
I have the JSP file (/page.jsp) in the root of my app directory. I

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.