File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Unable to compile class for JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Unable to compile class for JSP" Watch "Unable to compile class for JSP" New topic
Author

Unable to compile class for JSP

Ajit Krsna Das
Greenhorn

Joined: Apr 14, 2011
Posts: 5
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
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
One thing that jumps out is that the "if" condition is malformed.


Ping & DNS - updated with new look and Ping home screen widget
Ajit Krsna Das
Greenhorn

Joined: Apr 14, 2011
Posts: 5
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

Joined: Oct 17, 2009
Posts: 186


Try to convert single quotes into double quotes.
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 186
and welcome to JavaRanch.......
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 507
Hello


This should be



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

Regards,
Amit
Ajit Krsna Das
Greenhorn

Joined: Apr 14, 2011
Posts: 5
I managed to figure it ahwile back but thanks for your responses. Your help is much appreciated!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to compile class for JSP
 
Similar Threads
re:tomcat error
Problem in Login page
Login JSP page using mysql(DB)
Invalid Standard Action - Error
JSP <a href> tags breaks page functionality