Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to compile class for JSP

 
Ajit Krsna Das
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im sorry to bother all of you but I am relatively new to JSP and I'm currently working on my school practical that requires me to create a simple .jsp file that performs a login check. The problem is I have 0 experience with creating.jsp pages but I am faced with a bad start. When I access the .jsp from the post function of my html page, im faced with this error:

HTTP Status 500 -

type Exception report

message

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

exception

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 2 in the jsp file: /login.jsp
Invalid character constant
1: <%
2: String user = request.getParameter('username');
3: String pswd = request.getParameter('password');
4:
5: if(user.equals("John") && pswd.equals("godimsohot"){


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:95)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:374)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:352)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:339)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:344)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

My .jsp contains a few lines as follows


part of my html is as follows :



Any help is duely appreciated
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One thing that jumps out is that the "if" condition is malformed.
 
Ajit Krsna Das
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:One thing that jumps out is that the "if" condition is malformed.


Fixed it but the error remains
 
Ankit Tripathi
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Try to convert single quotes into double quotes.
 
Ankit Tripathi
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and welcome to JavaRanch.......
 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello


This should be



Use " " " instead of " ' " for String.

Regards,
Amit
 
Ajit Krsna Das
Greenhorn
Posts: 5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I managed to figure it ahwile back but thanks for your responses. Your help is much appreciated!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic