• Post Reply Bookmark Topic Watch Topic
  • New Topic

Creating a tag - error from tutorial  RSS feed

 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I apologize in advance if I am posting this question in the wrong forum, but this seemed like a good place. I'm learning how to create and use tags. So I'm a newbie and want to very much learn. I found this example on Sun's site (or I guess Oracle now), download the examples.zip from: http://java.sun.com/products/jsp/tutorial/TagLibraries15.html#62465

Right now, I'm trying to get the iteration.war file to compile. I had to download the JEE 1.5 to get the jar file (javaee) to compile the errors I was getting from the class IterationTag. Now that I have everything compiling, but the issue is now with the JSPs. I'm getting the following errors:

list.jsp - Department cannot be resolved to a type
index.jsp - org cannot be resolved
list.jsp - org cannot be resolved
index.jsp - Undefined type: Organization
list.jsp - Undedfined type: Organization

My Environment:
Windows XP
Tomcat v5.5
Java JDK 1.5
Eclipse 1.2.1

Any help is greatly appreciated.

Thanks in advance!
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're trying to compile a WAR file?

In any case, rather than making us download and build the application, how about posting your specific questions and the related code snippets?
 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David. Thanks for your reply.

I took the war (iteration) file and copied it (piece by piece) into an existing project in Eclipse. This is the code from the index.jsp:



When I execute the index.jsp, I am getting this error (shown below).

org.apache.jasper.JasperException: /index.jsp(7,1) The value for the useBean class attribute Organization is invalid.
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1191)
at org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1117)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2222)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:457)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
at org.apache.jasper.compiler.Generator.generate(Generator.java:3326)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:220)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:317)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)

Could my issue be with how I have the project setup in Eclipse? This is the directory structure of my project:

eFunStuff
* build directory contains: Organization, Department, IterationTag, IterationTEI and Member classes.
* WebContent directory
- META-INF directory contains: MANIFEST.MF file
- WEB-INF directory contains: taglib.tld, web.xml and lib directory which contains: jar files
- index.jsp

I'm not that familiar with Eclipse, but usually I see the classes under the class directory in the WEB-INF directory. Since my struts examples work fine with the classes in the build directory, I haven't moved the classes under the WEB-INF directory.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I have no idea what package the Organization class is in, so I can't help too much. You should, however, either a) make sure the built classes are being deployed, or b) set up Eclipse to build to the WEB-INF/classes directory.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, make sure all your classes are in packages other than the default package (no package defined).
 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks David and Mark! The mention of the word "package" made me realize, I needed to update the jsp to include the package name! That resolved my issue and now my jsp displays without any issues.

Thanks again!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!