Foren

Home » Liferay Portal » English » Liferay Legacy

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
Anderson A M Luna
HELP ME PLEASE!! Trying to make a Simple Struts Portlet to work for 2 years
9. November 2006 18:59
Antwort

Anderson A M Luna

Rang: New Member

Nachrichten: 2

Eintrittsdatum: 5. November 2006

Neue Beiträge

Dears,

I have being trying to develop a Struts Portlet since May 2005 (3.2 version) but I still could not!!

It made me crazy for times, I keep updating versions and Extension Environments but nothing helped!

This is my actual code running on EXT env. Liferay 4.1.2 with Tomcat:


 1
 2---------------------------------------------------------
 3liferay-portlet-ext.xml
 4---------------------------------------------------------
 5
 6<%@ include file="/html/portlet/ext/usrimc/init.jsp" %>
 7
 8<html>
 9<head><title>:: Page Name ::</title></head>
10
11<body bgcolor="#FFFFFF" link="#0066FF" vlink="#0066FF" alink="#0066FF">
12
13<br/><center> <h3> Page Title </h3> </center>
14
15<form action="<portlet:actionURL windowState="<%= WindowState.MAXIMIZED.toString() %>"><portlet:param name="struts_action" value="/ext/usrimc/actionusrimc" /></portlet:actionURL>" method="post" name="<portlet:namespace />fm">   
16   
17   
18<div align="left">
19      <tr> <td>
20           <p><font color="#0066FF" face="Verdana"><b>Nome:</font></b>
21    <input name="<portlet:namespace />nome" size="60" type="text" value="">
22</td></tr></div>
23    <hr color="#99CC66">      
24   
25</form>
26</body>
27</html>



 1
 2---------------------------------------------------------
 3liferay-portlet-ext.xml
 4---------------------------------------------------------
 5<?xml version="1.0"?>
 6<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 4.1.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_4_1_0.dtd">
 7
 8<liferay-portlet-app>
 9    <portlet>
10        <portlet-name>IMC_User</portlet-name>
11        <struts-path>ext/usrimc</struts-path>
12        <use-default-template>false</use-default-template>
13    </portlet>
14    <role-mapper>
15        <role-name>administrator</role-name>
16        <role-link>Administrator</role-link>
17    </role-mapper>
18    <role-mapper>
19        <role-name>power-user</role-name>
20        <role-link>Power User</role-link>
21    </role-mapper>
22    <role-mapper>
23        <role-name>user</role-name>
24        <role-link>User</role-link>
25    </role-mapper>
26    <role-mapper>
27        <role-name>guest</role-name>
28        <role-link>Guest</role-link>
29    </role-mapper>
30</liferay-portlet-app>


 1
 2---------------------------------------------------------
 3portlet-ext.xml
 4---------------------------------------------------------
 5<?xml version="1.0"?>
 6<portlet-app>
 7    <portlet>
 8     <portlet-name>IMC_User</portlet-name>
 9     <display-name>Consulta de IMC</display-name>
10     <portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>
11     <init-param>
12       <name>view-action</name>
13       <value>/ext/usrimc/view</value>
14     </init-param>
15     <expiration-cache>0</expiration-cache>
16    <supports>
17        <mime-type>text/html</mime-type>
18    </supports>
19    <resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>
20    <security-role-ref>
21        <role-name>administrator</role-name>
22    </security-role-ref>
23    <security-role-ref>
24        <role-name>guest</role-name>
25    </security-role-ref>
26        <security-role-ref>
27    <role-name>power-user</role-name>
28        </security-role-ref>
29    <security-role-ref>
30        <role-name>user</role-name>
31    </security-role-ref>
32</portlet>
33</portlet-app>


 1
 2---------------------------------------------------------
 3struts-config.xml
 4---------------------------------------------------------
 5<?xml version="1.0"?>
 6<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
 7
 8<struts-config>
 9    <!-- Forms Beans  -->
10    <form-beans>
11    <form-bean name="imcForm"                                       type="com.ext.portlet.usrimc.form.IMCForm" />
12    </form-beans>
13
14    <!-- Action Mappings -->
15    <action-mappings>
16
17    <action path="/ext/usrimc/view"                          forward="portlet.ext.usrimc.view" />
18
19    <action path="/ext/usrimc/actionusrimc"     type="com.ext.portlet.usrimc.action.IMCAction" name="imcForm"     scope="session" input="portlet.ext.usrimc.view">
20   
21    <forward name="/ext/usrimc/imc_successo"     path="portlet.ext.usrimc.imc_sucesso" />
22   
23    <forward name="/ext/usrimc/imc_erro"
24    path="portlet.ext.usrimc.imc_erro" />
25
26    </action>
27    </action-mappings>
28</struts-config>



 1
 2---------------------------------------------------------
 3tiles-defs.xml
 4---------------------------------------------------------
 5<?xml version="1.0" encoding="ISO-8859-1"?>
 6<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
 7
 8<tiles-definitions>
 9
10<definition name="portlet.ext.usrimc" extends="portlet" />
11<definition name="portlet.ext.usrimc.view"         extends="portlet.ext.usrimc">
12    <put name="portlet_content"     value="/portlet/ext/usrimc/view.jsp" />
13</definition>
14
15<definition name="portlet.ext.usrimc.imc_sucesso"     extends="portlet.ext.usrimc">
16    <put name="portlet_content"     value="/portlet/ext/usrimc/imc_sucesso.jsp" />
17</definition>
18
19<definition name="portlet.ext.usrimc.imc_erro"     extends="portlet.ext.usrimc">
20    <put name="portlet_content"     value="/portlet/ext/usrimc/imc_erro.jsp" />
21</definition>
22
23</tiles-definitions>



 1
 2---------------------------------------------------------
 3web.xml
 4---------------------------------------------------------
 5<?xml version="1.0" encoding="UTF-8"?>
 6<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
 7
 8<web-app>
 9 <taglib>
10  <taglib-uri>http://java.sun.com/portlet</taglib-uri>
11  <taglib-location>/WEB-INF/liferay-portlet.tld</taglib-location>
12 </taglib>
13 <taglib>
14  <taglib-uri>/tags/struts-bean</taglib-uri>
15  <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
16 </taglib>
17 <taglib>
18  <taglib-uri>/tags/struts-html</taglib-uri>
19  <taglib-location>/WEB-INF/struts-portlet-html.tld</taglib-location>
20 </taglib>
21 <taglib>
22  <taglib-uri>/tags/struts-logic</taglib-uri>
23  <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
24 </taglib>
25 <taglib>
26  <taglib-uri>/tags/struts-nested</taglib-uri>
27  <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
28 </taglib>
29 <taglib>
30  <taglib-uri>/tags/struts-tiles</taglib-uri>
31  <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
32 </taglib>
33
34</web-app>


02:55:36,796 ERROR [:704] Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts.taglib.html.BEAN" in any scope
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:935)
at org.apache.struts.taglib.html.BaseFieldTag.prepareValue(BaseFieldTag.java:121)
at org.apache.struts.taglib.html.BaseFieldTag.renderInputElement(BaseFieldTag.java:102)
at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:81)
at org.apache.jsp.html.portlet.ext.usrimc.view_jsp._jspx_meth_html_text_0(view_jsp.java:583)

at org.apache.jsp.html.portlet.ext.usrimc.view_jsp._jspService(view_jsp.java:465)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

....................................................................

Any help would be incredbily appreciated!!

Thank you,
Anderson
Ed F.
RE: HELP ME PLEASE!! Trying to make a Simple Struts Portlet to work for 2 y
10. November 2006 08:45
Antwort

Ed F.

Rang: Expert

Nachrichten: 280

Eintrittsdatum: 26. Juni 2006

Neue Beiträge

Hi, sorry you've had trouble, we all have.

I just wanted to make sure that top file wasn't really liferay-portlet.xml, but a jsp file isntead. I'm sure it is, but anyway.

Check out the Struts Portlet presentations at: http://www.liferay.com/web/guest/devzone/presentations

Also the Liferay wiki at: http://wiki.liferay.com/index.php/Developing_Struts_Based_Portlets_on_Liferay_Portal

It looks like you've got a very different method of development than what I use.
You should use the service builder.

Any questions, I'll do what I can.
Jorge Ferrer
RE: HELP ME PLEASE!! Trying to make a Simple Struts Portlet to work for 2 y
12. November 2006 10:25
Antwort

Jorge Ferrer

LIFERAY STAFF

Rang: Liferay Legend

Nachrichten: 2757

Eintrittsdatum: 31. August 2006

Neue Beiträge

It seems to be a problem related to the usage of Struts. In fact it looks like a Struts tag does not find an attribute it's looking for. But in the JSP you posted there is no usage of an Struts tag. Isn't there any other JSP code?