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.
Related
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 have a ApplicationBarIconButton which I use repeatedly on multiple pages.
I want to be able to define the Click action in my Application C# file.
I have
<Application.Resources>
<shell:ApplicationBarIconButton
x:Key="AddLocationAppBarIconBut"
IconUri="/icons/appbar.add.rest.png"
Text="location"
Click="Add_Location_Event" />
in my App.xaml file and I want to load it into another page I have under
<phone:PhoneApplicationPage.ApplicationBar>
How do I go about this exactly?
Can I bind a click event to an event in my Application cs file?
Unfortunately, you can't!
In full WPF framework, you'd be able to do something like this:
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar>
<shell:ApplicationBar.Buttons>
<StaticResource ResourceKey="AddLocationAppBarIconBut" />
</shell:ApplicationBar.Buttons>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
The trick here is in the usage of StaticResource, but Silverlight doesn't have a backing class representation like that; you can only use the Markup Extension as {StaticResource AddLocationAppBarIconBut}, but this won't help you here!
What you can is define the full ApplicationBar object as a resource and then just call it on the page like this:
<phone:PhoneApplicationPage ApplicationBar="{StaticResource ApplicationBarResource}">
<!-- remaining code -->
<phone:PhoneApplicationPage />
Here is a simple usecase which I don't manage to realise : I want to create a link or button which calls a server method (action) and will redirect to a page without preserving the cid parameter.
I'm using JSF2, JBoss 7 and Seam 3.
Here are two methods I tried without success.
First one, the h:commandLink
<h:commandLink action="pages/home.xhtml"
actionListener="#{identity.logout()}"
value="#{bundles.layout.logout}" />
Here, identity.logout() is called, but then, the browser is redirected to pages/home.xhtml?cid=1, so if I login again, I will have an
org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.ConversationScoped
error.
Second one, the h:link
<h:link outcome="/pages/home.xhtml" value="#{bundles.layout.logout}">
<f:ajax event="click" listener="#{identity.logout()}" />
</h:link>
Here, I don't have any cid in the generated hyperlink, but the method identity.logout() is not called...
Does someone have an idea ?
Using h:commandLink and calling conversation.end() from identity.logout() should work. You didn't include the code for identity.logout(), but I suspect you're not ending the conversation. By ending the conversation, you change it from long-running to transient, at which point it should not be propagated.
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