Datasheet

} else {
shaded = “white”;
}
%>
<tr bgcolor=”<%=shaded%>”>
<td>
<%=(i+1+startRow)%>. (<font color=”red”>
<%=form.format((hits.score(i)*100))%>%</font>)
<a href=”<%=doc.get(“url”)%>”><%=doc.get(“title”)%></a><br>
<%=doc.get(“summary”)%>
</td>
</tr>
<% } %>
</table>
</center>
As you can see, this is a simplistic search result page, providing only twenty-five search results, and no
paging capability.
Finally, the following code provides the portlet application deployment descriptor, also known as the
portlet.xml file:
<?xml version=”1.0” encoding=”UTF-8”?>
<portlet-app>
<portlet id=”LucenePortlet”>
<portlet-name>LucenePortlet</portlet-name>
<display-name>Example Search Portlet with Lucene</display-name>
<portlet-class>org.opensourceportals.samples.LucenePortlet</portlet-class>
<expiration-cache>-1</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>EDIT</portlet-mode>
<portlet-mode>VIEW</portlet-mode>
<portlet-mode>HELP</portlet-mode>
</supports>
<portlet-info>
<title>Example Search Portlet with Lucene</title>
<short-title>Lucene Search</short-title>
<keywords>Search, Lucene</keywords>
</portlet-info>
<portlet-preferences>
<preference>
<name>indexPath</name>
<value>C:\lucene\index</value>
</preference>
<preferences-
validator>org.opensourceportals.validator.LuceneValidator</preferences-validator>
</portlet-preferences>
</portlet>
</portlet-app>
The portlet.xml file is very basic, just like the portlet we just wrote. It provides three modes, and spec-
ifies a validator for its preferences.
38
Chapter 1
04 469513 Ch01.qxd 1/16/04 11:04 AM Page 38