How to implement pagination in grails portlet on Liferay.
The basic pagination was not working on Liferay. When clicked on next the page is jumping from Liferay url to normal url
I used like this :
<g:paginate next="Forward" prev="Back"
maxsteps="10" controller="book"
action="list" total="${Book.count()}" />
thanks in advance.
The normal pagination tag won't work inside a portlet, you'll need to copy the tag code and modify it to post to the actionURL of your portlet (call the jsp tag provided by the portal to get this url from your gsp tag code), instead of the default url for the controller.
I've never done this myself, someone else my be able to post some example code.
cheers
Lee
Related
I'm having difficulty to work with "renderURL". I created a new portlet, let's call it of "Portlet A", and one of my pages (wich is a simple CRUD), When I test acessing directly my Portlet It works perfectly.
The problem is that I trying to use my page, acessing It by another Portlet, let's call it of "Portlet B", and here's the complication because When I click at the button "save", instead of the system search for my method save() at the class MVCPortlet of Portlet A, It searchs at the class MVCPortlet of Portlet B.
Now at Portlet B, I call my page of Portlet A using "renderURL", like this:
<portlet:renderURL var="editInboxURL" >
<portlet:param name="mvcPath" value="/html/gerenciarinbox/search.jsp" />
<portlet:param name="eventoId" value="<%= eventoId %>"/>
<portlet:param name="redirect" value="%=themeDisplay.getURLCurrent()%>"/>
</portlet:renderURL>
and I access like this:
<aui:button value="Go to Portlet A" onClick="${editInboxURL}" />
I was wondering if There's somehow at the renderURL I specify that I don't want just to call my page, but I want to go to the "Portlet A" too.
I want to go the that specific page (search.jsp) and to the Portlet that It's belongs (Portlet A).
Can someone helps me?
I saw there's a way to work with "portlet:renderURL" addind a portletName, but I tryied and It didn't worked, It just stayed at the same page, nothing happened.
<liferay-portlet:renderURL portletName="gopointseventos_WAR_gopointseventosportlet" var="editInboxURL" >
<portlet:param name="mvcPath" value="/html/gerenciarinbox/search.jsp" />
<portlet:param name="eventoId" value="<%= eventoId %>"/>
<portlet:param name="redirect" value="<%= themeDisplay.getURLCurrent()%>"/>
</liferay-portlet:renderURL>
Thank you.
As per understanding, you want to create a render URL of PortletA from PortletB.
Please give it try from below code snippet.
LiferayPortletURL anotherPortletURL = PortletURLFactoryUtil.create(request,portletName,
plid, PortletRequest.RENDER_PHASE);
where plid can be retrieved from below code.
long plid= PortalUtil.getPlidFromPortletId(themeDisplay.getScopeGroupId(),isPrivateLayout, portletId);
First of all: a portlet is not a folder with some JSPs inside. A portlet can call any jsp inside its plugin (and a plugin can contain any number of portlets).
So your search.jsp it not belongs to Portlet B.
When in your Portlet A you call the search.jsp it is normal that the active portlet will always be the Portlet A.
Easiest way to achieve what you need is to copy the action method called by the save button in MVCPortlet of Portlet A.
I am trying to set up a global search box that posts to a search page in umbraco 7. This template uses a shared partial containing Html.BeginUmbracoForm() that points to a SurfaceController.
Since this is a global control, I want the form to be posted to the /search page instead of the current page. BeginUmbracoForm only seems to be able to post to the current page unless I'm mistaken.
I want something like RedirectToUmbracoPage(id), but clears this post values on redirect.
Is there a way to get an ActionResult like CurrentUmbracoPage which keeps the post values?
I would not try using surfacecontrollers for that purpose. Surfacecontrollers are auto routed. They are created to (e.g.) make #Html.Action(...) work on every umbraco page. Including postbacks on these actions or macros.
If you only need a "redirect" to the /search page, you don't need a surface controller. A simple partial will do the job.
<form action="/search" method="get">
Search <input type="search" name="q" />
</form>
Of course you can replace the url using some Umbraco logic like #Umbraco.TypedContentSingleAtXPath("//Search") or other Umbraco magic.
In the umbraco documentation project is an example where Html.Action is used.
I have simple primefaces portlet, which is connected to the database. I have view (index.xhtml) with the table, which presents all my entries from db (I'm using p:dataTable). I have also a simple view (someView.xhtml), which shows specific information about one selected entry. When I click in the table one entry, browser loads someView.xhtml and page url looks like this:
somepage?p_auth=wRR1tGze&p_p_id=SomePortlet&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_SomePortlet__facesViewIdRender=%2Fviews%2Findex.xhtml
I need to create url which directly shows me page someView.xhtml and get custom parameter from url.
I'm using primefaces 3.5 and liferay 6.2 with bridge 3.2.4.
Thanks in advance.
Marcin
Liferay Faces Bridge has a Facelet implementation of the portlet: JSP tags.
Not sure if that's what you are asking for, but you can do a full page HTTP GET by putting something like this in your facelet view:
<ui:composition xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:portlet="http://java.sun.com/portlet_2_0">
<portlet:renderURL var="renderURL">
<portlet:param name="_jsfBridgeViewId" value="someView.xhtml" />
</portlet:renderURL>
<h:outputLink value="#{renderURL}" />
</ui:composition>
I'm fairly new to Grails and can't seem to find a solution this problem.
I'm looking to pull in html from an external url and have it output on a GSP page. Something like this (knowing this doesn't actually work):
<g:render template="http://somesite.com/wp-admin/admin-ajax.php?action=include_banner" />
The reason I want to pull this html in is because we have duplicating html between our grails app and our wordpress instance.
Any help would be appreciated.
There can be two solution to this:
1) You can use iframe or object tag to render the html from external URL.
Example:
<object width="600px" height="600px" data="url">
</object>
or <iframe name="inlineframe" src="url" ></iframe>
2) Second, we can use the grails way:
You can define a custom tag which takes url as input
def myOwnRender={attrs,body->
out<<"""<div id="inline_div"></div><script type='text/javascript'>$.post("${attrs['url']}",function(result){
$("div#inline_div").html(result);
});</script>"""
}
First one seems to me a easier solution.
Hope that helps!!!
Thanks
I am using jsf 2. I have a link in a facelet file that points to a external url. My current view is /app1/home.xhtml with a h:commandLink that has an action like so
<h:commandLink value="#{link}" action="#{action.redirect}" target="_blank"/>
the url that action.redirect redirects to is /app2/info.do. However it appears that JSF tries to change the extension of the url to .xhtml. and then fails with the error message.
com.sun.faces.context.FacesFileNotFoundException: /app2/info.xhtml Not Found in ExternalContext as a Resource
how do i get this to correctly redirect ?
Don't use the <h:commandLink> here, it's the wrong tag for the purpose. It is designed to submit a JSF POST form and navigate to a JSF view, both which you obviously don't want to let take place in this particular use case.
Just use the <h:outputLink> or even plain HTML <a>. So,
<h:outputLink value="#{action.redirect}" target="_blank">#{link}</h:outputLink>
or
#{link}
Note that you don't need the <h:form> in both approaches.