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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:54:55+00:00 2026-05-18T23:54:55+00:00

I’m trying to make a little application with JSP. It’s a homework. So, i

  • 0

I’m trying to make a little application with JSP. It’s a homework. So, i have the index.jsp page, where the client enters his name, and if the client exists in the database, then it’s making a forward to clientexists.jsp, with the attribute client saved in the session. Then, the client has to make a choice from 2 radio buttons, and depending it’s choice, i need to show him his taxes to pay. But after his choice, I have this exception in the Console:

18: <INPUT TYPE="SUBMIT" NAME="buton2" VALUE="Continua"></form>
19: 
20: <%
21:     client = request.getAttribute("nume").toString();
22:     
23:     if (request.getParameter("buton2") != null)
24:     {


Stacktrace:] with root cause
java.lang.NullPointerException
    at org.apache.jsp.clientexists_jsp._jspService(clientexists_jsp.java:82)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:363)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:306)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:203)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:242)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:259)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:281)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

And in the web page, i have another one pointing to the same line:

org.apache.jasper.JasperException: An exception occurred processing JSP page /clientexists.jsp at line 21

Here is my index.jsp page:

<%@page import="dao.*"%>
<%@page import="model.*"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" import="java.util.*,java.text.*,java.io.*"%>
<jsp:useBean id="rep" class="dao.RepositoryDb"></jsp:useBean>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Tax machine</title>
</head>
<body>

<div align="center">

<h1>Your name:</h1>
<form method="POST" action="index.jsp"><INPUT TYPE="TEXT"
    NAME="name"><BR>
<BR>
<INPUT TYPE="SUBMIT" NAME="buton" VALUE="Continua"></form>

</div>
<%
    if (request.getParameter("buton") != null)
    {
        String client = request.getParameter("name");

        if (rep.clientExists(client))
        {
            session.setAttribute("nume", client);
%>
            <jsp:forward page="clientexists.jsp"></jsp:forward>
<%
        }
        else
        {
%>
            <jsp:forward page="clientnotexists.jsp"></jsp:forward>
<%
        }
    }
%>

</body>
</html>

And the clientexists.jsp page:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%! String client = null; %>
<jsp:useBean id="rep" class="dao.RepositoryDb"></jsp:useBean>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Choose your options</title>
</head>
<body>
<div align="center">

<form method="POST" action="clientexists.jsp">
<INPUT TYPE="RADIO" NAME="group" VALUE=paid" CHECKED>Paid taxes<BR>
<INPUT TYPE="RADIO" NAME="group" VALUE="unpaid">Unpaid taxes<BR>
<BR>
<INPUT TYPE="SUBMIT" NAME="buton2" VALUE="Continue"></form>

<%
    client = session.getAttribute("nume").toString();

    if (request.getParameter("buton2") != null)
    {
        String option = request.getParameter("group");

        if (option.equalsIgnoreCase("paid"))
        {
%>
            <%= rep.getImpozitePlatite(client).toString()%>
<%
        }
        else
        {
%>
            <%= rep.getImpoziteNeplatite(client).toString()%>
<%
        }
    }
%>
</div>
</body>
</html>

Could you help me please? Thanks

  • 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-18T23:54:55+00:00Added an answer on May 18, 2026 at 11:54 pm

    It is here

    request.getAttribute("nume").toString();
    

    request.getAttribute("nume") seems null and you are invoking toString() over null

    make it like

    client = "SOME_DEFAULT_VALUE";
    if(request.getAttribute("nume") != null){
    client = request.getAttribute("nume").toString();
    }
    

    For Client.jsp the error is there because I&Compiler can’t see the declaration of client variable

    A suggestion

    • how-to-avoid-java-code-in-jsp-files
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.