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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:18:06+00:00 2026-05-28T01:18:06+00:00

I am printing some values on a JSP from session using < bean:write />

  • 0

I am printing some values on a JSP from session using < bean:write /> successfully. But after submitting the page if I come back (after session expiry) and refresh page it print complete strack trace on the page saying;

< session attribute name> not found in session scope.

To avoid this I have done 2 things. But nothing worked for me.

  1. I had wrapped < bean:write /> inside < logic:empty />
  2. In the starting of the page I just checked whether value of < session attribute name> is null. If so, I am redirecting it to error page.

Same problem I am facing if I add attributes in request instead of session.

< request attribute name> not found in request scope.

Code from JSP to check session

HttpSession sess = request.getSession(false); 
if (sess == null) {response.sendRedirect("errorpg.jsp");} 
else{
    String sessionId_Logon = (String) sess.getAttribute("attrName");
    if(sessionId_Logon == null)
    {
            response.sendRedirect("errorpg.jsp");
    }
}

I know that “else” block is sense less. I had tried it alone as well.

  • 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-28T01:18:06+00:00Added an answer on May 28, 2026 at 1:18 am

    Well! I had found the problem i guess. < bean:write /> is getting compiled before than anything else. So my external checking for session is sense less.

    Now i have 2 solutions;

    1. Either i dont use < bean:write /> . Instead i can use scriptlet
    2. Or I Can check for session validity on some page upper in hirarchy
      like some master page.

    I am using the second one.

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

Sidebar

Related Questions

I'm printing out some values from a script in my terminal window like this:
I need to do some printing from my Java Swing application. I have tried
From first.jsp I am sending some parameters to result.jsp as - <a href=result.jsp?itemId=${itemId}&itemName=${item.itemName}&itemCode=${item.itemCode}')>Show Items</a>
For some reason this code is printing three values for the highest value in
I am using simplexml to read all the child nodes successfully. But how do
I have having some trouble printing a char from an ASCII value stored in
I am fixing some printing (plotter) problems in our java code(windows 32). The paper
I'm having some trouble with Visual Studio 2008. Very simple program: printing strings that
I have been researching options for printing report-like data via a web application. Some
I have a html form which the user inputs values/selects options. After selecting, these

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.