i have developed simple facelet portlet. changed viewhandler in faces-config.xml
said in book:
<?xml version='1.0' encoding='utf-8'?> <!doctype faces-config public "-//sun microsystems, inc.//dtd javaserver faces config 1.1//en" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd"> <faces-config xmlns="http://java.sun.com/jsf/configuration"> <application> <view-handler> com.sun.facelets.faceletportletviewhandler </view-handler> </application> <factory> <faces-context- factory>com.liferay.util.bridges.jsf.myfaces.myfacescontextfactoryimpl</faces- context-factory> </factory> </faces-config>
there 2 .xhtml
pages: template.xhtml
<?xml version="1.0" encoding="utf-8" ?> <f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"> <html> <head> </head> <body> <h:outputtext value="block"></h:outputtext> <h:outputlabel value="label" for="input"/> <h:inputtext id="input"/> text <ui:insert name="insertblock"> <h:outputtext value="defaulttext"></h:outputtext> </ui:insert> </body> </html>
and insertedblock.xhtml
<?xml version="1.0" encoding="utf-8" ?> <ui:composition template="template.xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"> <ui:define name="insertblock"> <h:outputtext value="inderted block"/> <h:outputlabel value="test label" for="testinput"/> <h:inputtext id="testinput"/> </ui:define> </ui:composition>
portlet.xml:
<?xml version="1.0" encoding="utf-8"?> <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" version="2.0" xsi:schemalocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"> <portlet> <portlet-name>liferayfirstportlet_war_exploded</portlet-name> <display-name>liferayfirstportlet_war_exploded</display-name> <portlet-class>com.test.helloworld</portlet-class> <init-param> <name>default-view</name> <value>insertedblock.xhtml</value> </init-param> <expiration-cache>0</expiration-cache> <supports> <mime-type>text/html</mime-type> </supports> <portlet-info> <title>liferayfirstportlet_war_exploded</title> </portlet-info> <security-role-ref> <role-name>administrator</role-name> </security-role-ref> <security-role-ref> <role-name>guest</role-name> </security-role-ref> <security-role-ref> <role-name>power-user</role-name> </security-role-ref> <security-role-ref> <role-name>user</role-name> </security-role-ref> </portlet> </portlet-app>
when deploy portlet on liferay - no errors displayed. when add portlet on page empty - empty rectangle. code of page (html code inspection in firebug) shown there no content in portlet either.
what did wrong?
did include liferay specific artifacts? porlet deployed in liferay, artifact needs liferay specific configuration files. can create skeletal artifact using liferay plugin sdk. (you can find in, additional files download section.)
or can download jsf samples , alter match configuration.
Comments
Post a Comment