Solved

JSP Error: URGENT

Posted on 2006-06-21
13
531 Views
Last Modified: 2008-02-01
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
Comment
Question by:suketu9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 2
13 Comments
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 16953099
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
 
LVL 27

Expert Comment

by:rrz
ID: 16953244
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
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 16953286
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:suketu9
ID: 16953518
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
 
LVL 27

Expert Comment

by:rrz
ID: 16953826
>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
 

Author Comment

by:suketu9
ID: 16954025
how can i print something to console in a jsp page, what code should i use.
0
 
LVL 27

Expert Comment

by:rrz
ID: 16956459
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
 

Author Comment

by:suketu9
ID: 16962370
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
 
LVL 27

Expert Comment

by:rrz
ID: 16963895
In  Search.jsp  show  us its  page directive with the import attribute.  Maybe someone will be able to help you.
0
 

Author Comment

by:suketu9
ID: 16970858
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
 
LVL 27

Expert Comment

by:rrz
ID: 16971025
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
 

Author Comment

by:suketu9
ID: 16971438
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
 
LVL 27

Accepted Solution

by:
rrz earned 500 total points
ID: 16972440
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Resolving an irritating Remote Desktop connection that stops your saved credentials from being used.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question