Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Roan Brasil Monteiro
Hello World using JSF + Eclipse Plugin + Liferay 5.2
June 17, 2009 2:44 PM
Answer

Roan Brasil Monteiro

Rank: New Member

Posts: 8

Join Date: May 26, 2009

Recent Posts

Hello everybody,

I am new with liferay portal and I am trying to do one thing, a simple Hello World using JSF.

I have the follow projects in my eclipse:

  • portal
  • ext


Then I clicked on "Create a JSF My Faces portlet" on eclipse liferay plugin. After that I don't know how to make the build.xml to run it because the plugin didn't create. Well, then I resolved only Zip the file and rename to roan.war . After that I upload the file on Liferay Portal and Add my Application. When I added my application the portlet is coming with the "Open" linked to http://localhost:8080/web/guest/home/-/waiapp/ROAN/ .

I don't know what's wrong, I wanna create the file using the plugin Create a JSF MY Faces portlet and the basic configuration is generated I wanna build on that. How to create the build xml on eclipse and what's content should be there to create the WAR File.

Basic I wanna export the basic configuration as:

web.xml
 1
 2<?xml version="1.0" encoding="ISO-8859-1"?>
 3<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 4                         "http://java.sun.com/dtd/web-app_2_3.dtd">
 5<web-app>
 6    <display-name>citespacetest</display-name>
 7    <context-param>
 8        <param-name>company_id</param-name>
 9        <param-value>liferay.com</param-value>
10    </context-param>
11    <context-param>
12        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
13        <param-value>client</param-value>
14    </context-param>
15    <context-param>
16        <param-name>javax.faces.application.CONFIG_FILES</param-name>
17        <param-value>/WEB-INF/faces-config.xml</param-value>
18    </context-param>
19    <listener>
20        <listener-class>com.liferay.portal.kernel.servlet.PortletContextListener</listener-class>
21    </listener>
22    <listener>
23        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
24    </listener>
25    <servlet>
26        <servlet-name>FacesServlet</servlet-name>
27        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
28        <load-on-startup>1</load-on-startup>
29    </servlet>
30    <servlet-mapping>
31        <servlet-name>FacesServlet</servlet-name>
32        <url-pattern>/faces/*</url-pattern>
33    </servlet-mapping>
34    <taglib>
35        <taglib-uri>http://java.sun.com/portlet</taglib-uri>
36        <taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location>
37    </taglib>
38</web-app>



This xml is generated automatically as the another one.

the faces-config.xml
 1
 2<?xml version="1.0" encoding="ISO-8859-1"?>
 3<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
 4                              "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
 5<faces-config>
 6    <factory>
 7        <faces-context-factory>com.liferay.util.jsf.apache.myfaces.context.MyFacesContextFactoryImpl</faces-context-factory>
 8    </factory>
 9    <managed-bean>
10        <managed-bean-name>user</managed-bean-name>
11        <managed-bean-class>com.sample.jsfmyfaces.bean.UserBean</managed-bean-class>
12        <managed-bean-scope>session</managed-bean-scope>
13    </managed-bean>
14</faces-config>


the liferay-portlet.xml

 1
 2<?xml version="1.0" encoding="ISO-8859-1"?>
 3<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 4.1.0//EN"
 4                                     "http://www.liferay.com/dtd/liferay-portlet-app_4_1_0.dtd">
 5<liferay-portlet-app>
 6    <portlet>
 7        <portlet-name>CITESPACETEST</portlet-name>
 8    </portlet>
 9    <role-mapper>
10        <role-name>administrator</role-name>
11        <role-link>Administrator</role-link>
12    </role-mapper>
13    <role-mapper>
14        <role-name>guest</role-name>
15        <role-link>Guest</role-link>
16    </role-mapper>
17    <role-mapper>
18        <role-name>power-user</role-name>
19        <role-link>Power User</role-link>
20    </role-mapper>
21    <role-mapper>
22        <role-name>user</role-name>
23        <role-link>User</role-link>
24    </role-mapper>
25</liferay-portlet-app>


the portlet.xml

 1
 2<?xml version="1.0" encoding="ISO-8859-1"?>
 3<portlet-app>
 4    <portlet>
 5        <portlet-name>CITESPACETEST</portlet-name>
 6        <display-name>citespacetest</display-name>
 7        <portlet-class>com.liferay.jsfmyfaces.portlet.MyFacesGenericPortlet</portlet-class>
 8        <init-param>
 9            <name>default-view</name>
10            <value>/index.jsp</value>
11        </init-param>
12        <supports>
13            <mime-type>text/html</mime-type>
14        </supports>
15        <security-role-ref>
16            <role-name>power-user</role-name>
17        </security-role-ref>
18        <security-role-ref>
19            <role-name>user</role-name>
20        </security-role-ref>
21        <portlet-info>
22            <title>citespacetest</title>
23            <short-title>citespacetest</short-title>
24            <keywords>citespacetest</keywords>
25        </portlet-info>
26    </portlet>
27</portlet-app>



the index.jsp is

 1
 2<%
 3/**
 4 * Copyright (c) 2000-2006 Liferay, LLC. All rights reserved.
 5 *
 6 * Permission is hereby granted, free of charge, to any person obtaining a copy
 7 * of this software and associated documentation files (the "Software"), to deal
 8 * in the Software without restriction, including without limitation the rights
 9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24%>
25
26<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
27<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
28
29<f:view>
30    <f:loadBundle basename="Language" var="msgs" />
31
32    Hello JSF MyFaces Portlet!
33</f:view>


I would like to know how to make the build.xml to this and how to generate the WAR file export and work. Thanks
Roan Brasil Monteiro
RE: Hello World using JSF + Eclipse Plugin + Liferay 5.2
June 18, 2009 6:23 AM
Answer

Roan Brasil Monteiro

Rank: New Member

Posts: 8

Join Date: May 26, 2009

Recent Posts

Hello everybody can help me please?