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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:03:22+00:00 2026-05-25T16:03:22+00:00

Need your help figuring this thing out. Scenario: On my JSP, I am trying

  • 0

Need your help figuring this thing out.
Scenario:
On my JSP, I am trying to print

<b>Season 1: ${season}</b>

<b>Season 2: ${season}</b>

this prints fine the first time (Both seasons print as “winter” initially). Now I wanted to add an if condition to change season value like:

<c:if test="${temperature eq 'HOT' || 'VERYHOT'}">
       <c:set var="season" value="summer is here" />
 </c:if>

On executing this if condition, Season 1 changes to “summer is here” but Season 2 stays the same. Why it stays so? Season 1 is part of page1.jsp and Season 2 is part of page2.jsp
and they are included inside parentPage.jsp

  • 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-25T16:03:23+00:00Added an answer on May 25, 2026 at 4:03 pm

    Two problems:

    First, your comparison is not valid. The 2nd condition is always true. Fix it accordingly:

    <c:if test="${temperature eq 'HOT' || temperature eq 'VERYHOT'}">
    

    Second, you’re storing the variable in the default page scope which is not shared among included JSP pages. Store it in request scope instead.

    <c:set var="season" value="summer is here" scope="request" />
    

    Update: as turns out per the comments, those JSPs do not participate in the same request. You should then grab the session scope (and be aware that this way the variable get exposed in all requests in all browser windows/tabs! this is not per-se desireable). You should only ensure that you’re specifying the scope in every <c:set var="season">.

    <c:set var="season" value="some value" scope="session" />
    

    The EL expression ${season} will namely search for the first non-null attribtue in respectively the page, request, session and application scopes. So if you do a <c:set> without an explicit scope, then it will be stored in page scope and obtained in same page as such.

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

Sidebar

Related Questions

ive being trying to cope with this problem but still. I need your help.
Need your help, trying to change this script: https://github.com/MrHus/jquery-monthly-ical To load external JSON data
I need help figuring out these php print (echo) statements and where to place
I need some help figuring out why the following scenario does not work. I'm
I need some help figuring out how to make some changes to some .jsp
I really need your help for this. I am relatively new to programming and
I need your help, i'm stacked on this project. When i run my applicaion
I need your help. I need to create live wallpaper like this : Bikini
Need your help...... We are trying to expose API's for auction website(asp.net 4.0) using
I need your help in this case: I have: 1 11 111 Cat1 a,b,c

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.