• 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

problem in jsp code(validation of customer details)

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page import = "connection.Db2Connection"

language="java" contentType="text/html; charset=ISO-8859-1"

pageEncoding="ISO-8859-1"%>

<%@page import= "java.sql.ResultSet" %>

<html>

<head>

<title>login</title>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<%
String uname = request.getParameter("username");

String pwd = request.getParameter("password");

Db2Connection con= new Db2Connection();

String qry="select login_pwd,customer_type,customer_status, no_of_attempts from db2admin.customer";

ResultSet rs=con.executeQuery(qry);//internall statement object will be created and it
// will handle the code
int no_of_attempts;
if("active".equals(rs.getString(3)))
{
if(pwd.equals(rs.getString(1)))
{
session.setAttribute("username",uname);
%>

<jsp:forward page="usercheck.jsp" /> //it will forward to a jsp which will check
// type of user
<% }
else
{
if(!(rs.getString(2).equals("admin")))
{
no_of_attempts=Integer.parseInt(rs.getString(4));
no_of_attempts++;
if(no_of_attempts==3)
{

qry="update db2admin.customer set customer_status='inactive' where customer_id='"+session.getAttribute("username")+"'";

con.executeUpdate(qry);

out.println("You have misused 3 attempts so your account has been locked contact your branch manager to unlock your account");

}
else
{
out.println("password error! NO of wrong attempts = "+ no_of_attempts);
out.println("Warning! If you enter three time wrong your account will be locked");

%>
<%@include file="../html/login.html" %>//redirects to login page
<% }
}
}
}
else
{
out.println("your account is in locked state");
%>
<%@ include file="../html/login.html" %>//redirects to login page
<% }
con.close(); %>



</body>
</html>


hello any one please tell me what is the wrong in the code

here Db2Conncetion is user defined class which handle jdbc code.

It is giving following error

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Bad version number in .class file
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.Validation_jsp._jspService(org.apache.jsp.Validation_jsp:167)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.UnsupportedClassVersionError: Bad version number in .class file
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(Unknown Source)
java.security.SecureClassLoader.defineClass(Unknown Source)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1629)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:850)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1299)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:150)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:71)
java.lang.ClassLoader.loadClassInternal(Unknown Source)
org.apache.jsp.Validation_jsp._jspService(org.apache.jsp.Validation_jsp:61)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
jsp

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A couple of things:

  • Please take the time to choose an appropriate forum for your posts. This forum is for questions on Servlets. For more information, please click this link ⇒ CarefullyChooseOneForum. This post has been moved to a more appropriate forum: JSP.


  • Please be sure to use code tags when posting code to the forums. Unformatted or unindented code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please click this link ⇒ UseCodeTags ⇐ for more information. Properly indented and formatted code greatly increases the probability that your question will get quicker, better answers.


  • java.lang.UnsupportedClassVersionError: Bad version number in .class file almost always means that you compiled a Java class using a compiler from a version of Java newer than one in which you are trying to run. For example, compiling with a Java 1.6 JDK, and trying to run it in a Java 1.5 JRE.
  •  
    reply
      Bookmark Topic Watch Topic
    • New Topic