Solved

JSP Error: URGENT

Posted on 2006-06-21
13
523 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
  • 6
  • 5
  • 2
13 Comments
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:suketu9
Comment Utility
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
Comment Utility
>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
Comment Utility
how can i print something to console in a jsp page, what code should i use.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 27

Expert Comment

by:rrz
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

HOW TO: Upload an ISO image to a VMware datastore for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere Host Client, and checking its MD5 checksum signature is correct.  It's a good idea to compare checksums, because many installat…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now