Liferay is a Gartner Magic Quadrant Leader for the Sixth Year! Find out why

Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Pradip A Bhatt
Liferay Web Service
April 26, 2013 7:26 AM
Answer

Pradip A Bhatt

Rank: Junior Member

Posts: 51

Join Date: January 29, 2013

Recent Posts

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
RE: Liferay Web Service
April 26, 2013 8:41 AM
Answer

Gwowen Fu

Rank: Expert

Posts: 315

Join Date: December 27, 2010

Recent Posts

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.
David H Nebinger
RE: Liferay Web Service
April 26, 2013 10:05 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 10355

Join Date: September 1, 2006

Recent Posts

Personally I'd use the LMB to have them message back and forth.
Pradip A Bhatt
RE: Liferay Web Service
April 29, 2013 9:39 PM
Answer

Pradip A Bhatt

Rank: Junior Member

Posts: 51

Join Date: January 29, 2013

Recent Posts

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?
David H Nebinger
RE: Liferay Web Service
April 30, 2013 5:50 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 10355

Join Date: September 1, 2006

Recent Posts

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.
Pradip A Bhatt
RE: Liferay Web Service
April 30, 2013 5:56 AM
Answer

Pradip A Bhatt

Rank: Junior Member

Posts: 51

Join Date: January 29, 2013

Recent Posts

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
Pradip A Bhatt
RE: Liferay Web Service
May 3, 2013 9:53 PM
Answer

Pradip A Bhatt

Rank: Junior Member

Posts: 51

Join Date: January 29, 2013

Recent Posts

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.
Pradip A Bhatt
RE: Liferay 6.2 With Strust2......
December 3, 2013 4:18 AM
Answer

Pradip A Bhatt

Rank: Junior Member

Posts: 51

Join Date: January 29, 2013

Recent Posts

I can not understand what u say.. please post your question in detail. So All can understand.
ranjit reval
RE: Liferay with struts2....
December 3, 2013 10:27 PM
Answer

ranjit reval

Rank: New Member

Posts: 9

Join Date: October 25, 2013

Recent Posts

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....
Pradip A Bhatt
RE: Liferay with struts2....
December 3, 2013 11:30 PM
Answer

Pradip A Bhatt

Rank: Junior Member

Posts: 51

Join Date: January 29, 2013

Recent Posts

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..
ranjit reval
RE: Liferay with struts2....
December 4, 2013 1:50 AM
Answer

ranjit reval

Rank: New Member

Posts: 9

Join Date: October 25, 2013

Recent Posts

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 ??
Pradip A Bhatt
RE: Liferay with struts2....
December 4, 2013 1:55 AM
Answer

Pradip A Bhatt

Rank: Junior Member

Posts: 51

Join Date: January 29, 2013

Recent Posts

Visit this one


http://liferay-struts2-portlet.blogspot.in/2012/01/simple-liferay-struts2-portlet.html
ranjit reval
RE: Liferay with struts2....
December 4, 2013 3:42 AM
Answer

ranjit reval

Rank: New Member

Posts: 9

Join Date: October 25, 2013

Recent Posts

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 Willer Lopez
RE: Liferay with struts2....
December 14, 2013 3:48 PM
Answer

Ronald Willer Lopez

Rank: New Member

Posts: 1

Join Date: May 11, 2013

Recent Posts

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
RE: Liferay with struts2....
January 5, 2014 11:18 PM
Answer

Jay Trivedi

Rank: New Member

Posts: 2

Join Date: October 25, 2013

Recent Posts

Hey Ranjit,

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

1<s:set var="portletnamespace" ><%=renderResponse.getNamespace()%></s:set>
2<s:form action="addBook">
3<s:textfield name="%{#portletnamespace}book.title" label="Book Title"></s:textfield>
4<s:textfield name="%{#portletnamespace}book.author" label="Book Author"></s:textfield>
5</s:form>
Henrique Andrade
RE: Liferay with struts2....
January 21, 2014 12:00 PM
Answer

Henrique Andrade

Rank: New Member

Posts: 6

Join Date: July 18, 2013

Recent Posts

Or you can add this in your liferay-portlet.xml:
1<requires-namespaced-parameters>false</requires-namespaced-parameters>

I had a similar problem in Liferay 6.2.

Henrique S