Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
{{AVMWarning}}
AVM
Alfresco has just begun to integrate web content management (WCM) features into its core repository and interface. As always, your feedback is appreciated!
CAVEAT: This page is seriously out of date..
Alfresco published a 'WCM Preview Release' in October of 2006 that contains a sample website which illustrates a technique for creating a JSP-based index page.
After you load alfresco-sample-website.zip into a 'staging' sandbox, take note of the following set of files:
Let's examine them one at a time.
Within this file you should see a snippet that reads:
<taglib>
<taglib-uri>http://www.alfresco.org/pr</taglib-uri>
<taglib-location>/WEB-INF/pr.tld</taglib-location>
</taglib>
This creates an association between the http://www.alfresco.org/pr tag library, and its tag library definition file /WEB-INF/pr.tld. The index.jsp file will make use of this association later.
The press release tag definition library associates a tag library URI (e.g.: http://www.alfresco.org/pr) with a set of functions. For example, the first function defined is:
<function>
<name>getPressReleases</name>
<function-class>org.alfresco.web.pr.Util</function-class>
<function-signature>
java.util.List
getPressReleases(javax.servlet.jsp.PageContext)
</function-signature>
</function>
This says:
There's another function defined in this file as well called getCompanyFooters (see the pr.tld file for details). Both of these functions are associated with the tag library URI http://www.alfresco.org/pr. The point being illustrated here is that you can define as many functions in a tag library definition file as you'd like.
Contains implementations of the functions used by the tag libraries.
TODO: remove everything but the low-level operations (e.g.: loadXMLDocuments) from this file, and modify pr.tld accordingly. The webapp-specific convenience functions should be sequestered elsewhere.
This file provides the implementation of the java bean returned by the function getPressReleases. This bean has getter functions that are used by JSP's expression language (e.g.: statements within a JSP of the form:
${...}
An index file that constructs a dynamic list of files within Alfresco's repository. Note that this index page begins with the following declaration:
<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/pr'
xmlns:fmt='http://java.sun.com/jsp/jstl/fmt'>
The fourth line (in bold) says 'import the tag lib URI named http://www.alfresco.org/pr and associate it with the XML namespace prefix pr. Recall that we defined this tag lib URI earlier in web.xml (see above).
Around line 90, you'll see a JSP statement like this:
<c:forEach items='${pr:getPressReleases(pageContext)}' var='pressRelease'>
That means 'loop over all items returned by the function call ${pr:getPressReleases(pageContext)} using a temporary variable for the 'current' item called pressRelease. Recall that:
Thus the following expression invokes the press release listing convenience function within our index.jsp:
${pr:getPressReleases(pageContext)}
On around line 91, you can see this loop variable being used:
<jsp:attribute name='href'><c:out value='${pressRelease.href}'/></jsp:attribute>
Note, within PressReleaseBean.java, the PressReleaseBean class has the following getter:
public String getHref()
{
return this.href;
}
Thus, in JSP expression language the following statement in your index.jsp:
${pressRelease.href}
is translated into a call to that getter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.