Solved

JSP Error: URGENT

Posted on 2006-06-21
13
525 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When we talk about DevOps toolchains, I sometimes wonder how many people really get what we’re talking about. I don’t know if it’s just semantics or tone or something else, but sometimes I think it just sounds like buzzword sausage. So it’s always …
Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 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

15 Experts available now in Live!

Get 1:1 Help Now