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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:07:22+00:00 2026-05-29T23:07:22+00:00

I have an attribute which I have forwarded from a servelet to a jsp

  • 0

I have an attribute which I have forwarded from a servelet to a jsp file and while I can use this object with EL I’d like to know how to access it inside the java tags. An example is something like the following:

 Searching for "${search_phrase}" returned
  <c:forEach var="video" items="${results}">
      ${video.getVideoName()}
      ${video.getVideoID()}       
  </c:forEach>

So results here is an ArrayList of type Video which is forwarded from a servlet to a jsp

I would like to access this ArrayList inside <% %> tags in order to perform some more involved tasks that I cant do with EL.

Anybody know how to do this?

On a side note, this ArrayList I’m creating could potentially get large. Where is this stored? On the server or in some users temp files? If it’s stored in server memory does it get cleaned after some period of time / an event such as the user that requested the ArrayList closes connection to server?

  • 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-29T23:07:23+00:00Added an answer on May 29, 2026 at 11:07 pm

    It all depends where you stored the list. If you stored it in a request attribute (and not anywhere else), then it will be eligible to garbage-collection when the request has been handled.

    If you stored it in a session attribute, then it will be stored in the server memory (and/or the file system or the database depending on the container configuration) until the session times out or is invalidated, or until you remove it. HTTP is a stateless protocol. The user doesn’t have a connection to the server.

    Java code between <% %> is not a java tag. It’s scriptlet, and should not be used in a JSP. If you need to do something that EL or JSP tags can’t do easily, then either

    • write a custom JSP tag yourself, put the Java code in this JSP tag, and invoke the tag from the JSP, or
    • or write a custom EL function, and invoke this function from the JSP
    • or prepare the work in a controller (servlet, MVC framework action) before dispatching to the JSP, so that the JSP can generate the markup easily.

    The list is accessible using the getAttribute method corresponding to the setAttribute method you used to store the list:

    HttpServletRequest.setAttribute() --> HttpServletRequest.getAttribute()
    HttpSession.setAttribute() --> HttpSession.getAttribute()
    ServletContext.setAttribute() --> ServletContext.getAttribute()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class which is marked with a custom attribute, like this: public
I have a custom attribute which can be assigned to a class, [FooAttribute] .
I have a jsp tag which takes a javax.el.MethodExpression as attribute: <%@ attribute name="action"
Question 1) I have a control to which I add an attribute from the
I have a domain object that has an attribute which is a collection containing
I have an attribute which is annotated with @Id. The ID is going to
I have a class which has a private attribute which is a reference to
I have created an Attribute, call MyAttribute, which is performing some security and for
how do i switch on an enum which have the flags attribute set (or
I have a class which has a private attribute vector rectVec; class A {

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.