• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting Exception creating bean of class JSP Exception

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting the below JSP Exception

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Exception creating bean of class com.sample.form.UserLoginForm: {1}
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

The UserLoginForm.java is as below

package com.sample.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;


public class UserLoginForm extends ActionForm{
private String userid = null;
private String password = null;
public void reset(ActionMapping mapping,HttpServletRequest request){
this.userid=null;
this.password=null;
}


public ActionErrors validate(

ActionMapping mapping, HttpServletRequest request ) {
ActionErrors errors = new ActionErrors();
return errors;
}

public String getPassword() {
return password;
}


public void setPassword(String password) {
this.password = password;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
}
The login.jsp is as below

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<html:html locale="true">
<head>
<title>Login Page</title>
</head>
<html:base/>
<body>
<center>
<table >
<tr>
<td> <html:form action="/login" method="post">
<table border="1" class="signup">
<tr>
<td >User Login
<html:errors/></td>
</tr>
<tr >
<td >User ID:</td>
<td ><html:text property="userid" size="30" maxlength="30"/></td>
</tr>
<tr >
<td >Password:</td>
<td><html:password property="password" size="30" maxlength="30"/></td>
</tr>
<tr>
<td ><html:submit>Sign-In !</html:submit></td>
</tr>
</table>
</html:form>
</td>
</tr>
</table>
</center>
<body>
</html:html>

And the struts-config.xml is as below

<struts-config>
<form-bean name="UserLoginForm"
type="com.sample.form.UserLoginForm">
</form-bean>
<action-mappings>
<action
path="/login"
name="UserLoginForm"
scope="request"
validate="false"
input="/pages/login.jsp"
type="com.sample.action.loginAction">
<forward name="success" path="/pages/task.jsp"/>
<forward name="failure" path="/pages/login.jsp"/>
</action>
</action-mappings>

Please help me out why this exception is coming.
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Priyanka please UseCodeTags when you post source code.

Also this might help you...
 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Priyanka

Shouldn't your form-bean be defined inside <form-beans></form-beans> tag?
 
No, tomorrow we rule the world! With this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic