Foren

Liferay Web Service

thumbnail
Pradip Bhatt, geändert vor 10 Jahren.

Liferay Web Service

Junior Member Beiträge: 51 Beitrittsdatum: 29.01.13 Neueste Beiträge
Hello All...

I am developed 3 different portlet in Liferay 6.2.0m2. I am using Struts2 + Spring3.0.5 and Hibenate technology. All my these modules runs specifically and well.
Now My question is that how can I connect this my modules internally. is Liferay provides some mechanism to interconect these modules. Note that Here, in my case all these portlets are individual like one is PIM another Admin andother Recruitment... And Using Web Service is this possible??

I am not using Service Builder here...

I want to integrate all this three and become one System(HRMS).

Please help me on this.
Please reply me as early as possible.

Thankssssss in Advance...

Pradip Bhatt
Ahmedabad - India
Mob : (+91) 9328278401
Gwowen Fu, geändert vor 10 Jahren.

RE: Liferay Web Service

Expert Beiträge: 315 Beitrittsdatum: 27.12.10 Neueste Beiträge
One way to do it is to use <liferay-portlet:resourceURL> tag in your jsp page. This tag creates a link to other portlet's resource method.
thumbnail
David H Nebinger, geändert vor 10 Jahren.

RE: Liferay Web Service

Liferay Legend Beiträge: 14914 Beitrittsdatum: 02.09.06 Neueste Beiträge
Personally I'd use the LMB to have them message back and forth.
thumbnail
Pradip Bhatt, geändert vor 10 Jahren.

RE: Liferay Web Service

Junior Member Beiträge: 51 Beitrittsdatum: 29.01.13 Neueste Beiträge
Thanks sir,

Example :
My requirement like fetching Job category from Admin portlet to Employee Information Portlet. It means data passing size may be become more.

Is it possible in this way?
thumbnail
David H Nebinger, geändert vor 10 Jahren.

RE: Liferay Web Service

Liferay Legend Beiträge: 14914 Beitrittsdatum: 02.09.06 Neueste Beiträge
You do not need to pass the whole content in LMB; in fact in normal messaging systems you'd pass a reference to the corresponding data and let the recipient find the actual message content. Saves the load on the messaging system and maintains performance levels.
thumbnail
Pradip A Bhatt, geändert vor 10 Jahren.

RE: Liferay Web Service

Junior Member Beiträge: 51 Beitrittsdatum: 29.01.13 Neueste Beiträge
Thankssss Sir,

Can you please give me small example which describe what you say???

Because I have no much knowledge about Liferay framework..

If possible..... My requirement is neat and clean that i have to passed out data between two different portlet.

Thankssssssss in advance
thumbnail
Pradip A Bhatt, geändert vor 10 Jahren.

RE: Liferay Web Service

Junior Member Beiträge: 51 Beitrittsdatum: 29.01.13 Neueste Beiträge
Hello....
Finally , I successfully integrated Jersey RESTful web service with portlet.
You have to understand what is jersey framework.

For more inquiry...

Visit this..

Liferay Jersey

Contact me.

Pradip Bhatt.
thumbnail
ranjit reval, geändert vor 10 Jahren.

RE: Liferay 6.2 With Strust2......

New Member Beiträge: 9 Beitrittsdatum: 25.10.13 Neueste Beiträge
hi pradip,
i am also using liferay 6.2 ce + strust2 but i am not gettgin jsp value in strust2 action after submitting jsp form

kindly help....
thanks advance.......
thumbnail
Pradip A Bhatt, geändert vor 10 Jahren.

RE: Liferay 6.2 With Strust2......

Junior Member Beiträge: 51 Beitrittsdatum: 29.01.13 Neueste Beiträge
I can not understand what u say.. please post your question in detail. So All can understand.
thumbnail
ranjit reval, geändert vor 10 Jahren.

RE: Liferay with struts2....

New Member Beiträge: 9 Beitrittsdatum: 25.10.13 Neueste Beiträge
Hi Pradip,

Jsp
------------------------
<s:form action="addApmc" namespace="/apmc" theme="simple" method="post">
<s:textfield name="apmcName" label="Name" value=""/>
<s:textfield name="apmcDesc" label="Description" value=""/>
<s:textfield name="apmcLocation" label="Location" value=""/>

<s:submit value="submit" align="center"/>
</s:form>
-------------------------------
strust.xml
----------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
<constant name="struts.devMode" value="false" />

<package namespace="/apmc" extends="struts-portlet-default,json-default" name="apmc">
<interceptors>
<interceptor-stack name="storeStack">
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="store">
<param name="operationMode">STORE</param>
</interceptor-ref>
</interceptor-stack>
<interceptor-stack name="retrieveStack">
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="store">
<param name="operationMode">RETRIEVE</param>
</interceptor-ref>
</interceptor-stack>
</interceptors>


<action name="index">
<result>/html/apmc/view.jsp</result>
</action>

<action name="addApmc" class="com.struts2.action.AddAPMCDetails" method="execute">
<result name="success">/html/apmc/AddApmc.jsp</result>
<result name="error">/html/apmc/view.jsp</result>
</action>

</package>
</struts>
----------------------------------------
AddAPMCDetails.java File
---------------------------------
Instance variable and getter setter of apmcName....other

public String execute() throws Exception {

System.out.println("Name" + getApmcName() );
System.out.println("Location " + getApmcLocation() );
System.out.println("Desc... " + getApmcDesc() );

apmc apmcList=getApmcDetails();
apmcLocalServiceUtil.addapmc(apmcList);

return SUCCESS;
}
----------------------------
Library used for struts2 is

struts2-core-2.2.1.jar
struts2-portlet-plugin-2.3.1.1.jar
xwork-core-2.2.1.jar
freemarker-2.3.16.jar
.
.
other required...


-------------------------------
I m using Liferay 6.2.0 ce ga1 with struts2
--------------------------------------------------------------
My Question is that when i Submit the Strust Form i m getting null value for all parameter i have passed in struts2 form in Jsp like (apmcName..desc...and loc).
How can i get all parameter value in Java Action File. I have already make getter setter for all instance variable and also try using object referance..
But Still Getting null......... value..

Please...Help....
thumbnail
Pradip A Bhatt, geändert vor 10 Jahren.

RE: Liferay with struts2....

Junior Member Beiträge: 51 Beitrittsdatum: 29.01.13 Neueste Beiträge
AS per my first point of view

You should have to use

<s:textfield name="<entityName>.<attributeName>" label="Name" value=""/>

in your jsp file.

Suppose :
Entity / pojo class :
class Student{
int rno;
String name;

// GETTER - SETTER

}

class YOUR_ACTION_CLASS
{
Student student;
// GETTER - SETTER of student

public void execute()
{
System.out.println("Name :" + student.getName());
System.out.println("Student Name :" + name);
}
}

jsp file :
<form action="YUOR_ACTION" method="POST">
<s:textfield name="student.name" label="Name" value=""/>
</form>

It will be work..
thumbnail
ranjit reval, geändert vor 10 Jahren.

RE: Liferay with struts2....

New Member Beiträge: 9 Beitrittsdatum: 25.10.13 Neueste Beiträge
Hi Pradip

As per your suggestion I have implement new portlet but getting nullpointer exception at following point
System.out.println("Name :" + student.getName());

portlet.xml
---------------------
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
-------------------------------------------------
web.xml
-----------------------
<listener>
<listener-class>com.liferay.portal.kernel.spring.context.PortletContextLoaderListener</listener-class>
</listener>

<servlet>
<servlet-name>struts2servlet</servlet-name>
<servlet-class>org.apache.struts2.dispatcher.ng.servlet.StrutsServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>struts2servlet</servlet-name>
<url-pattern>*.action</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>struts2Resources</servlet-name>
<servlet-class>org.apache.struts2.dispatcher.ng.servlet.StrutsServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>struts2Resources</servlet-name>
<url-pattern>/struts/*</url-pattern>
</servlet-mapping>

<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri>
<taglib-location>
/WEB-INF/tld/liferay-portlet.tld
</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://liferay.com/tld/aui</taglib-uri>
<taglib-location>/WEB-INF/tld/aui.tld</taglib-location>
</taglib>
</jsp-config>

--------------------------------------------------------------------------

As well as tell me list of library file you are using...

can you send any small example using liferay with struts2 ??
thumbnail
Pradip A Bhatt, geändert vor 10 Jahren.

RE: Liferay with struts2....

Junior Member Beiträge: 51 Beitrittsdatum: 29.01.13 Neueste Beiträge
Visit this one


http://liferay-struts2-portlet.blogspot.in/2012/01/simple-liferay-struts2-portlet.html
thumbnail
ranjit reval, geändert vor 10 Jahren.

RE: Liferay with struts2....

New Member Beiträge: 9 Beitrittsdatum: 25.10.13 Neueste Beiträge
Hi Pradip,

I have already tried this link....but it's not work for me.

are you also using liferay 6.2???

If it is possible then please send me small kind of example war file as well as tell me list of library file you are using for strust2 configuration with liferay 6.2

Thanks Advance
Ronald Lopez, geändert vor 10 Jahren.

RE: Liferay with struts2....

New Member Beitrag: 1 Beitrittsdatum: 11.05.13 Neueste Beiträge
Hello. I have the same problem. My project works for the 6.1.2 version without any problem. But when I change it to version 6.2, it stopped working sending values ​​submit sends "null". However, sending values ​​renderURL works.

<portlet:renderURL var="nameURL" windowState="pop_up">
<portlet:param name="struts.portlet.action"
value="/view/view/name" />
<portlet:param name="codigoOferta" value="${oferta.id}" />
<portlet:param name="tituloOferta" value="${oferta.titulo}" />
</portlet:renderURL>

Anyone know at what the problem is?.

Sorry for the english, I'm a translator.
Jay Trivedi, geändert vor 10 Jahren.

RE: Liferay with struts2....

New Member Beitrag: 1 Beitrittsdatum: 25.10.13 Neueste Beiträge
Hey Ranjit,

Put portlet name sapce before the name of elements of form:

<s:set var="portletnamespace">&lt;%=renderResponse.getNamespace()%&gt;</s:set>
<s:form action="addBook">
<s:textfield name="%{#portletnamespace}book.title" label="Book Title"></s:textfield>
<s:textfield name="%{#portletnamespace}book.author" label="Book Author"></s:textfield>
</s:form>
thumbnail
Henrique Andrade, geändert vor 10 Jahren.

RE: Liferay with struts2....

New Member Beiträge: 9 Beitrittsdatum: 18.07.13 Neueste Beiträge
Or you can add this in your liferay-portlet.xml:
<requires-namespaced-parameters>false</requires-namespaced-parameters>

I had a similar problem in Liferay 6.2.

Henrique S