Solved

JSP Error: URGENT

Posted on 2006-06-21
13
526 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
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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
method inner class 6 82
IE doesn't Invoke servlet in iframe 1 111
maven j2ee examles 2 55
maven webservice example issue 2 133
One of the biggest threats facing all high-value targets are APT's.  These threats include sophisticated tactics that "often starts with mapping human organization and collecting intelligence on employees, who are nowadays a weaker link than network…
When you’re making plans to join the modern business race, you should analyze various details that may affect your results. Nowadays, millions of businesses are trying to grow into established and appreciated professional enterprises.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 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

18 Experts available now in Live!

Get 1:1 Help Now