cancel
Showing results for 
Search instead for 
Did you mean: 

jsp page, trying to use class function, failing

jmonkfish
Champ in-the-making
Champ in-the-making
I am trying to modify the sample press-release page that comes with Alfresco in \Alfresco\extras\wcm

I have created a new web project with a \ROOT\news directory containing: index.jsp,
and a \ROOT\WEB-INF directory containing: web.xml, pr.tdl, lib\classes\org\alfresco\web\pr\PressReleaseBean.class

index.jsp
<jsp:root version="1.2"
          xmlns:jsp="http://java.sun.com/JSP/Page"
     xmlns:c="http://java.sun.com/jsp/jstl/core"
     xmlns:pr="http://www.alfresco.org/alfresco/pr"
          xmlns:fmt="http://java.sun.com/jsp/jstl/fmt">
  <!– xmlns:pr is mapped to /WEB-INF/pr.tld by web.xml –>

  <jsp:output doctype-root-element="html"
         doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
         doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'/>

  <jsp:directive.page language="java" contentType="text/html; charset=UTF-8"/>
  <jsp:directive.page isELIgnored="false"/>
  <jsp:directive.include file="header.html"/>

  <!– BEGIN MAIN CONTENT –>

  <h1>Press Releases</h1>
 
  <!– load all PressReleaseBeans by using the function defined in /WEB-INF/pr.tld –>
  <c:forEach items="${pr:getPressReleases(pageContext)}" var="pressRelease">
  …
web.xml
        …
        <taglib-uri>http://www.alfresco.org/alfresco/pr</taglib-uri>
        <taglib-location>/WEB-INF/pr.tld</taglib-location>
        …
pr.tdl
<?xml version="1.0" encoding="UTF-8" ?>

<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd"
        version="2.0">

    <tlib-version>1.0</tlib-version>
    <short-name>pr</short-name>
    <uri>http://www.alfresco.org/alfresco/pr</uri>
    <function>
      <name>getPressReleases</name>
      <function-class>org.alfresco.web.pr.PressReleaseBean</function-class>
      <function-signature>java.util.List getPressReleases(javax.servlet.jsp.PageContext)</function-signature>
    </function>
    …

The problem is that I get this error when I try to load index.jsp:
org.apache.jasper.JasperException: The class org.alfresco.web.pr.PressReleaseBean specified in TLD for the function pr:getPressReleases cannot be found: org.alfresco.web.pr.PressReleaseBean

Are there more files that I need to include than those?  I'm unfamiliar with JSP, but I'm trying to get a basic demonstration of how Alfresco will work for our companies needs.

Thanks,
Johnathan
1 REPLY 1

jmonkfish
Champ in-the-making
Champ in-the-making
Got some help from a co-worker…

Modified the alfresco-sample-website.war file to only include files from /WEB-INF/ and bulk-imported it, and now there's no errors.