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

  • Home
  • SEARCH
  • 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 5939379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:49:12+00:00 2026-05-22T15:49:12+00:00

i have made a small web application with form.html output.jsp ServletOne.java In the form.html,users

  • 0

i have made a small web application with
form.html
output.jsp
ServletOne.java

In the form.html,users enters his name and chooses a icecream flavour
both the username and icecream flavour are set as session attributes
these are displayed on output.jsp after processing by ServletOne.java

i am facing three problems:
1.session.isNew() returns true ,i have used sesssion ,then why is it still a new session
2. i am not able to use else in the jsp,getting syntax error on token
3.there is a log out button on the output.jsp
now i want that on clicking the log out button,the user should able to go out of session

can someone help

here are the files:

<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Welcome</title>
</head>
<body>
<%String abc=(String)session.getAttribute("name"); %>
<%=  "Welcome"+((String)session.getAttribute("textfield"))%></br>
<%= "You have choosen"+abc %>
<% if(session.isNew()) {%>
<% out.println("Wellllllllll"); %>
<%} %>
<% else  {}%>
<form action="/ApplicationOne/Form.html" method="post" name="Logput">
<input name="Logout" type="submit" />


</form>
</body>
</html>

ServletOne.java

HttpSession session=req.getSession();
        resp.setContentType("text/html");
        PrintWriter pw=resp.getWriter();
        String Icecream=req.getParameter("RadioGroup1");
        session.setAttribute("name",Icecream );
        session.setAttribute("textfield",req.getParameter("textfield"));
        IceCream ob=(IceCream)getServletContext().getAttribute("icecream");
        //pw.println("<html><body>");
        //pw.println("Ice-Cream Flavour is"+ob.getFlavour());
        //pw.println("Enjoy "+Icecream+"</html></body>");
        session.setMaxInactiveInterval(1200);
        RequestDispatcher view=req.getRequestDispatcher("/Output.jsp");
        view.forward(req, resp);

form.html

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<form id="form1" name="form1" method="post" action="/ApplicationOne/Welcome">
  <p>
  LoginID
    <input type="text" name="textfield"  />
    <br/>
  SELECT VALUE <br/>

    <label>
      <input type="radio" name="RadioGroup1" value="Vanilla" id="RadioGroup1_0" />
      Vanilla</label>
    <br />
    <label>
      <input type="radio" name="RadioGroup1" value="Chocolate" id="RadioGroup1_1" />
      CHocholate</label>
    <br />
    <label>
      <input type="radio" name="RadioGroup1" value="Strawberry" id="RadioGroup1_2" />
      Strawberry</label>
    <br />

    <input type="submit" name="Submit" id="Submit" value="Submit" />
    <br />
  </p>
</form>
</body>
</html>
  • 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-22T15:49:13+00:00Added an answer on May 22, 2026 at 3:49 pm

    1.session.isNew() returns true ,i have used sesssion ,then why is it still a new session

    Probably because the server container has just created a new session. Take a look at the request and response headers and at your browser’s cookie cache. Is a session cookie being set? Does the session cookie keep changing?

    2.i am not able to use else in the jsp,getting syntax error on token

    Look at the Java code generated for the JSP and look for the syntax error there. The file will be some temporary directory in the web container directory tree.

    3.there is a log out button on the output.jsp
    now i want that on clicking the log out button,the user should able to go out of session

    You will need to do this in a servlet. The simple way would be to call invalidate on the Session object. This may or may not work, depending on how your login mechanism / session cookie management is implemented.

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

Sidebar

Related Questions

We have developed a small web application for a client. We decided on the
I have made a web application that uses master page for Login & Logout
I was developing a small WAMP web application on my laptop, where I have
I have made a SVG image, or more like mini application, for viewing graphs
I have made a custom UserControl i Vb.net (windows application). How can I add
Background I have made a Web Service in Visual Studio, and I'm trying to
I created my ClickOnce application witch will install a small windows form application that
I have just started programming and have made a few small applications in C
I have a web application that I developed with the Google Web Toolkit (GWT),
I have made a small test app with a button and a UISlider. Touching

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.