Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Pradip A Bhatt
Liferay Web Service
26. April 2013 07:26
Antwort

Pradip A Bhatt

Rang: Junior Member

Nachrichten: 51

Eintrittsdatum: 29. Januar 2013

Neue 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
RE: Liferay Web Service
26. April 2013 08:41
Antwort

Gwowen Fu

Rang: Expert

Nachrichten: 280

Eintrittsdatum: 27. Dezember 2010

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

David H Nebinger

Rang: Liferay Legend

Nachrichten: 7215

Eintrittsdatum: 1. September 2006

Neue Beiträge

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

Pradip A Bhatt

Rang: Junior Member

Nachrichten: 51

Eintrittsdatum: 29. Januar 2013

Neue 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?
David H Nebinger
RE: Liferay Web Service
30. April 2013 05:50
Antwort

David H Nebinger

Rang: Liferay Legend

Nachrichten: 7215

Eintrittsdatum: 1. September 2006

Neue 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.
Pradip A Bhatt
RE: Liferay Web Service
30. April 2013 05:56
Antwort

Pradip A Bhatt

Rang: Junior Member

Nachrichten: 51

Eintrittsdatum: 29. Januar 2013

Neue 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
Pradip A Bhatt
RE: Liferay Web Service
3. Mai 2013 21:53
Antwort

Pradip A Bhatt

Rang: Junior Member

Nachrichten: 51

Eintrittsdatum: 29. Januar 2013

Neue 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.
Pradip A Bhatt
RE: Liferay 6.2 With Strust2......
3. Dezember 2013 04:18
Antwort

Pradip A Bhatt

Rang: Junior Member

Nachrichten: 51

Eintrittsdatum: 29. Januar 2013

Neue Beiträge

I can not understand what u say.. please post your question in detail. So All can understand.
ranjit reval
RE: Liferay with struts2....
3. Dezember 2013 22:27
Antwort

ranjit reval

Rang: New Member

Nachrichten: 9

Eintrittsdatum: 25. Oktober 2013

Neue 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....
Pradip A Bhatt
RE: Liferay with struts2....
3. Dezember 2013 23:30
Antwort

Pradip A Bhatt

Rang: Junior Member

Nachrichten: 51

Eintrittsdatum: 29. Januar 2013

Neue 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..
ranjit reval
RE: Liferay with struts2....
4. Dezember 2013 01:50
Antwort

ranjit reval

Rang: New Member

Nachrichten: 9

Eintrittsdatum: 25. Oktober 2013

Neue 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 ??
Pradip A Bhatt
RE: Liferay with struts2....
4. Dezember 2013 01:55
Antwort

Pradip A Bhatt

Rang: Junior Member

Nachrichten: 51

Eintrittsdatum: 29. Januar 2013

Neue Beiträge

Visit this one


http://liferay-struts2-portlet.blogspot.in/2012/01/simple-liferay-struts2-portlet.html
ranjit reval
RE: Liferay with struts2....
4. Dezember 2013 03:42
Antwort

ranjit reval

Rang: New Member

Nachrichten: 9

Eintrittsdatum: 25. Oktober 2013

Neue 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
RE: Liferay with struts2....
14. Dezember 2013 15:48
Antwort

Ronald Lopez

Rang: New Member

Nachrichten: 1

Eintrittsdatum: 11. Mai 2013

Neue 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
RE: Liferay with struts2....
5. Januar 2014 23:18
Antwort

Jay Trivedi

Rang: New Member

Nachrichten: 2

Eintrittsdatum: 25. Oktober 2013

Neue Beiträge

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....
21. Januar 2014 12:00
Antwort

Henrique Andrade

Rang: New Member

Nachrichten: 5

Eintrittsdatum: 18. Juli 2013

Neue Beiträge

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