dcsimg
Error 500 when tried to run a jsp page
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Shahrizal_Wagirin
Posted On:   Tuesday, March 25, 2003 10:14 PM

I tried to run a code I got from a website, but I got errors. I am a beginner trying to learn JSP. I installed Tomcat 4.1.24, JDK 1.4.1. Here is the code: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <%@ page language="java" import="java.util.*" %> Welcome Today is Day: <%= clock.getDayOfMonth() %> Year: <%= clock.getYear() %> <%-- Check for AM or PM --%> <%! int time = Calendar.getInstance().get(Calendar.AM_PM); %> <% if (time == Calendar.AM) { %> Good Morning <% } else {    More>>

I tried to run a code I got from a website, but I got errors. I am a beginner trying to learn JSP. I installed Tomcat 4.1.24, JDK 1.4.1. Here is the code:


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++





<%@ page language="java" import="java.util.*" %>

Welcome


Today is




  • Day: <%= clock.getDayOfMonth() %>
  • Year: <%= clock.getYear() %>

<%-- Check for AM or PM --%>
<%! int time = Calendar.getInstance().get(Calendar.AM_PM); %>


<%
if (time == Calendar.AM) {
%>


Good Morning


<%
}
else {
%>


Good Afternoon


<%
}
%>








++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I got errors as the following:

Generated servlet error:
[javac] Since fork is true, ignoring compiler setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler setting.
[javac] C:TomcatworkStandalonelocalhostch01ch01_09_jsp.java:52: cannot resolve symbol
[javac] symbol : class jspCalendar
[javac] location: class org.apache.jsp.ch01_09_jsp
[javac] jspCalendar clock = null;
[javac] ^
[javac] C:TomcatworkStandalonelocalhostch01ch01_09_jsp.java:54: cannot resolve symbol
[javac] symbol : class jspCalendar
[javac] location: class org.apache.jsp.ch01_09_jsp
[javac] clock = (jspCalendar) pageContext.getAttribute("clock", PageContext.PAGE_SCOPE);
[javac] ^
[javac] C:TomcatworkStandalonelocalhostch01ch01_09_jsp.java:57: cannot resolve symbol
[javac] symbol : class jspCalendar
[javac] location: class org.apache.jsp.ch01_09_jsp
[javac] clock = (jspCalendar) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "jspCalendar");
[javac] ^
[javac] 3 errors



at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:536)



I already put tools.jar and servlet.jar in CLASSPATH. Have no idea what errors are these.
Thank you    <<Less

Re: Error 500 when tried to run a jsp page

Posted By:   Christopher_Koenigsberg  
Posted On:   Wednesday, March 26, 2003 06:40 AM

cannot resolve symbol [javac] symbol : class jspCalendar



That is a problem. You have to add the "import" directive for the package that this class comes from.

About | Sitemap | Contact