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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:51:03+00:00 2026-06-03T03:51:03+00:00

i have a jsp. which calls a servlet on jsp load and display the

  • 0

i have a jsp. which calls a servlet on jsp load and display the results in same jsp as below.

Some.jsp

<html>

    <jsp:include page="/HelloWorld"/>

    <%Iterator itr;%>
<% List data= (List)request.getAttribute("results");
for (itr=data.iterator(); itr.hasNext(); )
{
%>


<TABLE align="center" cellpadding="15" border="1" style="background-color: #ffffcc;">
                    <TR>
                        <TD align="center"><%=itr.next()%></TD>
                    </TR>

            </TABLE>

<%}%>


    </body>
</html>

in servlet i am storing results in request and using requestdispatcher to invoke the jsp as below.

public class SomeServlet extends HttpServlet {

    public void doGet(HttpServletRequest request, 
              HttpServletResponse response)
              throws ServletException,IOException{

        List<String> list = new ArrayList<String>();

        //some logic to populate list

        request.setAttribute("results", list);
        request.getRequestDispatcher("/WEB-INF/Some.jsp").forward(request, response);


              }

}

But i am getting below exception while displaying results in jsp:

java.io.IOException: Stream closed
    at org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:202)
    at org.apache.jasper.runtime.JspWriterImpl.clearBuffer(JspWriterImpl.java:157)

Please help me..

  • 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-03T03:51:05+00:00Added an answer on June 3, 2026 at 3:51 am

    The JSP includes the servlet, which forwards to the JSP, which includes the servlet, which forwards to the JSP, which includes the servlet, which forwards to the JSP, which includes the servlet, which forwards to the JSP, which includes the servlet, which forwards to the JSP, which includes the servlet, which forwards to the JSP, which includes the servlet, which forwards to the JSP…

    You have a serious design issue here. Adopt the MVC principles: all requests go to a servlet (Controller), which loads the Model, and dispatches to the appropriate JSP (View). A view should not include a servlet, and certainly not in a recursive way like this.

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

Sidebar

Related Questions

I have a jsp page which contains a form which calls a servlet, after
I have a JSP page that renders, and calls a Web service to load
I have a JSP page which accepts SQL queries, performs them then returns the
I have a jsp page which needs a java code. This java code inside
I have a JSP page, which accepts user strings in more than 23 languages.
I have a servlet which takes us to an existing jsp, say home.jsp. This
I have some questions which are as follows: How can I use the JSP
Hi I have a page in my java/jsp based web application which shows list
I wrote custom servlet in Liferay and want to know which user page calls
I have a request which returns a jsp page. But the fact is, the

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.