Sun Java System Portal Server 7.1 Developer's Guide

Creating portlet.xml File

Every portlet WAR must have one portlet.xml file in the WEB-INF directory of the web application. When creating the portlet.xml file, note that:

Here is a sample portlet.xml file for struts-portlet application:

<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/
portlet/portlet-app_1_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/portlet
/porlet-app_1_0.xsd" version="1.0">

<portlet>
	<portlet-name>StrutsPortlet</portlet-name>
	<portlet-class>org.apache.struts.action.
	StrutsPortlet</portlet-class>
	<init-param>
		<name>initPage</name>
		<value>/index.jsp</value>
	</init-param>
	<init-param>
		<name>helpPage</name>
		<value>/tour.htm</value>
	</init-param>
	<init-param>
		<name>editPage</name>
		<value>/edit.jsp</value>
	</init-param>
	<init-param>
		<name>factoryPage</name>
		<value>com.sun.portal.struts.wrapper.
		PSServletObjectsFactory</value>
	</init-param>
	<init-param>
		<name>config</name>
		<value>/WEB-INF/struts-config.xml,/WEB-INF/
		struts-config-registration.xml</value>
	</init-param>
	<init-param>
		<name>servletPage</name>
		<value>*.do</value>
	</init-param>
		<expiration-cache>0</expiration-cache>
		<supports>
			<mime-type>text/html</mime-type>
			<portlet-mode>HELP</portlet-mode>
			<portlet-mode>EDIT</portlet-mode>
		</supports>
	<portlet-info>
		<title>StrutsPortlet</title>
	</portlet-info>
	</portlet>
</portlet-app>