user3227262
user3227262

Reputation: 583

WARNING: StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception java.lang.NullPointerException glassfish

hi I am new to java web programming. Have written two simple jsp pages. one to accept the name, and second to show the entered name. I dont know what and where is wrong with my code. Can any one help me debug the issue. I am attaching my code here

index.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
</head>
<body>
    <h1>Entry Form</h1>
</body><form name="input_form" action="response.jsp">Enter Your Name : <input    type="text" name="name" value="" /><input type="submit" value="Ok" name="submit" />
</form>
</html>

response.jsp

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
</head>
<body><jsp:useBean id="mybean" scope="session" class="org.mypackage.hello.NameHandler" />
    <jsp:setProperty name="request" property="" /><h1>Hello, <jsp:getProperty name="mybean" property="name" />!</h1>
</body>

The exception is thrown on response.jsp page.

Upvotes: 1

Views: 4699

Answers (1)

Aniket Kulkarni
Aniket Kulkarni

Reputation: 12983

two simple jsp pages. one to accept the name, and second to show the entered name.

In response.jsp write just

${param.name}

That will display name from index.jsp

Why are you using <jsp:useBean> when you are submitting page to response.jsp?

Need more information to help you further.

Upvotes: 1

Related Questions