• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 536
  • Last Modified:

JSP Error: URGENT

Hi ,
I am new to JSP and I am getting following error when I add this one line to my jsp page:
<%=System.out.printl("hi")%>. I am using eclipse and tomcat 5.5. Please let me know why it is not working.

Following is the error.
Jun 21, 2006 12:26:06 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 31 in the jsp file: /index.jsp
Generated servlet error:
The method print(boolean) in the type JspWriter is not applicable for the arguments (void)


      at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
      at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
      at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Thread.java:595)
0
suketu9
Asked:
suketu9
  • 6
  • 5
  • 2
1 Solution
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
it must be <%=System.out.println("hi")%> not <%=System.out.printl("hi")%>. ( n is missing)

use out.println directly

check out

http://www.jsptut.com/Scriptlets.jsp
0
 
rrzCommented:
I am not sure what you want to do here. But try either
<%="hi"%>   to display on the page
or  
<%
     System.out.print("hi");   // to display on console
%>
0
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
sorry it must be <% System.out.println("hi"); %>
or <% System.out.print("hi"); %>
not
<%=System.out.printl("hi")%>

any of them will work yet check out that tutor i mentioned.(simple one).

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
suketu9Author Commented:
I am using <%=System.out.println("Hi")%> to output it to console, sorry for miss typing when posting, and i get that error that i have posted above, dont know why? Please let me know if its something to do with librarys,etc.
0
 
rrzCommented:
>The method print(boolean) in the type JspWriter is not applicable for the arguments (void)
An expression  <%=  %>  is used to print something to the page. But System.out.println("Hi") returns void, there is nothing to print.
0
 
suketu9Author Commented:
how can i print something to console in a jsp page, what code should i use.
0
 
rrzCommented:
Did you try  ?
<%
     System.out.print("hi");   // to display on console
%>
This assumes that the "standard" output stream will go to the console.  Tomcat could send it to a log file. I am not an expert on logging though.
0
 
suketu9Author Commented:
I got that to work. Now when I click on one of the links on this page I get this page. This code was working fine in WSAD 5.0 and Websphere 5.0 but since we changed to Eclipse and Tomcat I am getting following error, is it something to do with jre, jdk or API. Please let me know.

Jun 22, 2006 1:55:07 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP

Generated servlet error:
Only a type can be imported. com.ccfna.mobilesource.server.common.TechDataBO resolves to a package

Generated servlet error:
Only a type can be imported. com.ccfna.mobilesource.server.common.DeviceBO resolves to a package

An error occurred at line: 233 in the jsp file: /AdminWeb/Search.jsp
Generated servlet error:
DeviceBO cannot be resolved to a type

An error occurred at line: 233 in the jsp file: /AdminWeb/Search.jsp
Generated servlet error:
DeviceBO cannot be resolved to a type

An error occurred at line: 233 in the jsp file: /AdminWeb/Search.jsp
Generated servlet error:
TechDataBO cannot be resolved to a type

An error occurred at line: 233 in the jsp file: /AdminWeb/Search.jsp
Generated servlet error:
TechDataBO cannot be resolved to a type


      at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
      at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
      at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Thread.java:595)
0
 
rrzCommented:
In  Search.jsp  show  us its  page directive with the import attribute.  Maybe someone will be able to help you.
0
 
suketu9Author Commented:
Following is my import attribute.  This page use to work fine WSAD but since we changed to eclipse its giving me above error. Please let me know whats wrong.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page import = "com.ccfna.mobilesource.server.common.TechDataBO"%>
<%@ page import = "com.ccfna.mobilesource.server.common.DeviceBO"%>
<%@ page import = "java.util.Collection"%>
<%@ page import = "java.util.Iterator"%>
0
 
rrzCommented:
Where are the DeviceBO and TechDataBO classes located ?  Show the complete paths ? The classes shoud be in their package structure. If they are in a jar they should be in your context's lib folder. If they are not in ajar then they should be in your context's classes folder.
0
 
suketu9Author Commented:
they are located in java source folder. classes are in their package structure, since I dont get any compile errors or anything in eclipse. I am using eclipse I have my java classes in Java Source folder. I just changed the name src to Java Source and I have all my java classes in this folder and its is in thier package.
0
 
rrzCommented:
I don't use Eclipse so I am not much help. You can ask to get this question deleted and have your points refunded since we didn't help you here.
Ask another question with Eclipse in the title to attract an expert.  Meanwhile look in your context's classes folder( in Tomcat ) and see if your compiled classes are there in their package.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 6
  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now