Liferay portlet sharing objects between portlet class and JSP - portlet

I am new to Portlets and also with Liferay Portal and I want to know how to share a custom object created in the Portlet doView method with the JSP page. I know about adding the object to the ActionRequest and retrieving it in the JSP but is there a better way ?
Thank you guys.

Check out Liferay's Inter-portlet communication (IPC). Here's a link that describes the IPC (via examples) http://wiki.java.net/bin/view/Portlet/JSR168FAQ#How_do_I_achieve_inter_portlet_c
hope this helps.

Related

Alfresco - Call page (Share Webscript) on JAVA class (Repository) for workflow

Context:
I have a webpage with an applet in the Share side. The webpage can be seen through the link
localhost:8080/share/page/hdp/ws/my-page?file=nodeRefOfFile
Problem:
I define a custom workflow. I want integrate this applet in the workflow for the user accept the task.
I define a Java class in repository side that is called in workflow.
How can I call the webpage (Share side) in JAVA class that I use in the workflow. In JAVA class I have a nodeRef of the file of the workflow, but I don't know too how can I refresh file on javascript and gives the nodeRef to JAVA. My problem is communicate JAVA (repository) with javascript (share).
I have to make a webscript repository with the page? Any suggestion?
Answer changed: the OP is trying to integrate an applet with the Share workflow. I'd highly recommend loading the applet inside of a new custom component and calling the applet from the task's workflow validation.
The component itself can calculate the url of the file you want to sign, or you can read the form data and get the url of the file with Ajax. Finally, the applet will need to write the signed file into a hidden field (via base64). Before posting the workflow form, you can use ajax to send the file to the repository. Use the share proxy url to avoid needing to authenticate with the repository.

How to hide a navigation bar in liferay theme based on the custom service response?

I am working on lIferay 6.2 portal developement where I have requirement where i have to hide a navigation bar in liferay theme based on the response from custom service. and let me know is it possible to make only one web service call for checking this condition in liferay theme and use the same response in liferay portlets present in same page? thanks in advance.
You can write hook with Custom ServicePreAction implementation.
By overriding servlet.service.events.pre=com.custom.CustomServicePreAction
In your Custom ServicePreAction, you can make call to webservice and set some request attribute to define whether navigation should be shown or not.
In theme's vm you can get request attributes by $request.getAttribute("attrname")
Haven't tried this but hope this would help you.
Regards,

How to call web service method from Web content display in Liferay 6.2?

I am creating a page using Liferay 6.2 where i need to display html contents sent as response from web service method. After seeing the customization and features available in web content display, i am planning to use them. As i am new to VM and FTL, i am not sure how to call web service method from web content display content. Please help me.
You can create a custom velocity tool as explained in this post.

Liferay 6 :display a plain jsp page

Need your help guys. Any hint how can i dispaly a plain jsp in liferay context but without any liferay goodies, like theme, dockbar etc. Just a simple jsp page with some text.
I did that a while ago and what I did was to create a servlet in a portlet listening to some kind of URL. Example :
http://your-server:8080/my-portlet/my-servlet
Inside this Servlet you can then do a forward to the JSP in your portlet.
Any user accessing this URL will then be forwarded to a full JSP without any liferay stuff.

How to call wicket page from servlet

My application is mixed of wicket and jsp page . In my case i have to call wicket page from servlet with some value in request object . could someone please explain as how to achieve this. Thanks
What do you mean 'call a wicket page'? Do you mean load a wicket page to the user after he performs some action on the servlet-loaded page?
What exactly is your use case for this?
I think it would be better NOT to mix jsp and wicket, but given that you did:
BookmarkablePages provide a way to directly address a wicket page as it has a bookmarkable url (for instance, /home instead of /page?13). We use those to load a certain page with certain request parameters (ie, /student/1234/results shows the resultpage for student 1234).
Also, you could implement some kind of listener service that, based upon a certain call/payload, constructs a wicket page and returns the url for that page but that seems a bit overkill. In most cases I think bookmarkable pages a should suffice.
Have a look at http://wicket.apache.org/apidocs/1.5/org/apache/wicket/protocol/http/WebApplication.html#mountPage(java.lang.String, java.lang.Class)
or
http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/