tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 6697] New: - can't use simple javabean in jsp (as per book example*)
Date Tue, 26 Feb 2002 23:26:57 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6697>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6697

can't use simple javabean in jsp (as per book example*)

           Summary: can't use simple javabean in jsp (as per book example*)
           Product: Tomcat 4
           Version: 4.0.2 Final
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: BuckWoodson@hotmail.com


I thought this was a config issue or bug in 4.0.1 that would be fixed.  I do 
not having tried it in 4.0.2 in the num directories where an example works 
fine.  I tried as many legal permutations as I could think of.

Symptom: cannot create simple javabean and use in jsp:

<TomcatDIR>\webapps\examples\jsp\num\numguess.jsp using
<TomcatDIR>\webapps\examples\WEB-INF\classes\num\NumberGuessBean.class
works

<TomcatDIR>\webapps\examples\jsp\num\simplebean.jsp 
<TomcatDIR>\webapps\examples\WEB-INF\classes\num\lineBean.class
fails

~

simplebean.jsp:

<%@ page language="java" import="num.lineBean" %>
<jsp:usebean id="bn" class="num.lineBean" scope="session"/>
<html>
<head>

<title>Using JavaBeans</title>
</head>
<body>



<%= bn.stars(20)%>

Welcome to my Web page

<%= bn.doubleLine(30)%>

</body>
</html>

~

lineBean.java:

package num;

import java.util.*;
import java.lang.*;

public class lineBean
{
	public lineBean()
	{

  	}

	public String stars(int x)
	{
		String text = "<BR>";
		for (int i = 0; i < x; i++)
			text += "*";
		return text + "<BR>";
	}

	public String doubleLine(int x)
	{
		String text = "<BR>";
		for (int i = 0; i < x; i++)
			text += "=";
		return text + "<BR>";
	}

}

~

error:

org.apache.jasper.JasperException: Unable to compile class for JSPNote: 
sun.tools.javac.Main has been deprecated.


An error occurred at line: 12 in the jsp file: /jsp/num/simplebean.jsp

Generated servlet error:
C:\Tomcat4.0.2\work\localhost\examples\jsp\num\simplebean$jsp.java:59: 
Undefined variable or class name: bn
                out.print( bn.stars(20));
                           ^


An error occurred at line: 16 in the jsp file: /jsp/num/simplebean.jsp

Generated servlet error:
C:\Tomcat4.0.2\work\localhost\examples\jsp\num\simplebean$jsp.java:66: 
Undefined variable or class name: bn
                out.print( bn.doubleLine(30));
                           ^
2 errors, 1 warning

	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:285)
	at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:552)
	at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary
(JspServlet.java:177)
	at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service
(JspServlet.java:189)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:382)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
	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:243)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:190)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke
(AuthenticatorBase.java:475)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
	at org.apache.catalina.valves.CertificatesValve.invoke
(CertificatesValve.java:246)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2343)
	at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:180)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:170)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
	at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:170)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
	at org.apache.catalina.valves.AccessLogValve.invoke
(AccessLogValve.java:468)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:174)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.connector.http.HttpProcessor.process
(HttpProcessor.java:1012)
	at org.apache.catalina.connector.http.HttpProcessor.run
(HttpProcessor.java:1107)
	at java.lang.Thread.run(Thread.java:536)

~

*page 122 JavaServer Pages ISBN: 0764535420

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message