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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:52:22+00:00 2026-05-28T03:52:22+00:00

i have one login.jsp web page where i have two textboxes for username and

  • 0

i have one login.jsp web page where i have two textboxes for username and password when user cliks on submit button my web page **

is forwarded to jsp servlet checkpass.jsp where

  1. code checks for authenticity of user that is checks for correctness of username and password ,
  2. if user is valid then session is get created,i have set some seeion attributes like name, id,etc and
  3. depending on type of user that is whether he is admin or just user i am again forwarding my checkpass.jsp page to perticular page. This all coding is done in check pass.jsp

** i prevented caching of most of pages . but pages like login.jsp , logout.jsp ,index.jsp . session gets created only if user is valid i didn’t write code to check session that is code like

<%
try{
   String username = session.getValue("UserName").toString();
   String s_Password = session.getValue("password").toString();
   String id = session.getValue("ID").toString();
   // String s_Email = session.getValue("email").toString();
   if ((username==null) ||  (s_Password==null) || (id==null))
       {
    %>
      <jsp:forward page="index.jsp?error=You have Logged Out !!!" />
    <% 
    }}
   catch(Exception e)
   {
       e.printStackTrace();           
               %><jsp:forward page="index.jsp?error=" />
               <% 
    }
%>

such code is not there . so what happens, though i prevented caching of other including checkpass.jsp, when i logout session is terminated through session.invalidate() method. so when i use back button of my browser it doesnt dispaly the pages all pages gets redirected to index.jsp as i coded above. but as such code is not there is checkpass.jsp browser displays me some message saying that try to reload page because this page requires some data i.e i guess user name and password and when i press refresh button of my browser it displays me my admin.jsp pages i want that when anyone logouts none of web pages should be displayed though i press back or refresh button button of my browser. this is my web application . for this i am using net beans and MySQL and Apache tomcat. please help me to get out of problem. i will be pleased to provide any more info. if needed

  • 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-28T03:52:23+00:00Added an answer on May 28, 2026 at 3:52 am

    You’re not redirecting. You’re forwarding. You need to send a redirect instead of a forward.

    response.sendRedirect("index.jsp");
    

    This way the server will instruct the client to send a brand new GET request on the given resource, instead of using the given resource as response for the current POST request as will happen with a forward. So refreshing won’t re-submit the previous POST request.

    See also:

    • In the context of Java Servlet what is the difference between URL Rewriting and Forwarding?

    Unrelated to the concrete problem, I have no idea what the restrictions/requirements are been put by your tutor/course, but writing Java code in JSP files instead of Java classes (e.g. a servlet class or a filter class) and using deprecated methods is not the best practice. Just saying for the case your points depend on that as well.

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

Sidebar

Related Questions

I have one image submit button like this <input id=enter name=enter type=image value=Login src=images/btn_login.jpg/>
I have implemented antiforgery token on my login page. Now I had one user
I have made small web-app in jsp with a start page with login and
I have two jsps. One is login_first.jsp , another one is main.jsp . After
I have a usual login form consisting of two input fields, one for login,
I have a problem on my site's login page in IE7 browser. One of
i am doing one small application , wheich have login functionality, in the user
I try to create login form in web application. in JSP page I can
I have one web app which under the login process stores the userId in
I have a JSP page that has 2 forms running on Tomcat 6. One

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.