Fórum

[SOLVED] Ways to use portlet:resourceURL?

thumbnail
Natalie D, modificado 11 Anos atrás.

[SOLVED] Ways to use portlet:resourceURL?

Junior Member Postagens: 55 Data de Entrada: 06/02/12 Postagens Recentes
Do somebody know how to translate JS snippet below:

	var newUrl;
	newUrl = new Liferay.PortletURL('RESOURCE_PHASE');
	newUrl.setPortletId('sample_WAR_sampleportlet');
	newUrl.setResourceId('veryImportantResource');

into JSP scriptlet? I mean something like:


	<portlet:resourceurl var="someUrl" id="veryImportantResource'">
	</portlet:resourceurl>


Natalie
thumbnail
Natalie D, modificado 11 Anos atrás.

RE: Ways to use portlet:resourceURL? (Resposta)

Junior Member Postagens: 55 Data de Entrada: 06/02/12 Postagens Recentes
I've found it.

<portlet:resourceurl < code></portlet:resourceurl>
<br>is useless. I have to use instead <strong>liferay-portlet:resourceURL</strong>, which have all needed parameters: <br><br>Documentation says:<br><blockquote><br> liferay-portlet:resourceURL is similar to portlet:resourceURL except it has<br> the additional attributes plid, portletName, anchor, and encrypt.<br><br> Set varImpl to set the PortletURL object. This gives you an object reference<br> to the underlying URL implementation.<br><br> Set plid to the plid of another layout. This allows you to post the URL to<br> another layout.<br><br> Set portletName to the name of a portlet other than the current portlet.<br> This allows you to post the URL to another portlet.<br><br> Set anchor to false if you do not want the page to refresh and anchor to the<br> current portlet.<br><br> Set encrypt to true if you want to encrypt all the parameter values.<br><br> Set doAsUserId to process this URL as if it is accessed by the specified<br> user.</blockquote><br><br>Hope it helps somebody<br>Natalie
thumbnail
mohammed ansari, modificado 11 Anos atrás.

RE: Ways to use portlet:resourceURL?

New Member Postagens: 11 Data de Entrada: 08/02/11 Postagens Recentes
Great Natalie..

So what does your
<liferay-portlet:resourceurl />
now looks like?
thumbnail
Natalie D, modificado 11 Anos atrás.

RE: Ways to use portlet:resourceURL?

Junior Member Postagens: 55 Data de Entrada: 06/02/12 Postagens Recentes
mohammed ansari:
Great Natalie..

So what does your
<liferay-portlet:resourceurl />
now looks like?


If You read my previous post it would be clear to You.
Just try.

Regards
min huang, modificado 11 Anos atrás.

RE: Ways to use portlet:resourceURL?

New Member Postagens: 18 Data de Entrada: 15/11/12 Postagens Recentes
HI Natalie!
I have question about how to use Liferay.PortletURL in my jsp page?

you can see my code.

<script>
var portletURL = new Liferay.PortletURL();
portletURL.setParameter("key1", "value");
portletURL.setParameter("key2", "value");
portletURL.setPortletId(86);
alert( "that is the url: " + portletURL.toString() );
</script>


it is very simple,but when i run it ,i got a error: Liferay.PortletURL is undefined

i have no idea about it,is it i not include some js file?

By the way, my liferay version is 6.0.5CE!

Thanks!!!
min huang, modificado 11 Anos atrás.

RE: Ways to use portlet:resourceURL?

New Member Postagens: 18 Data de Entrada: 15/11/12 Postagens Recentes
HI!
I have got a way to use this moeth,like this


AUI().ready('liferay-portlet-url', function(A) {
    		         var renderURL = Liferay.PortletURL.createRenderURL();
    	 	        renderURL .setParameter("struts_action","/communities/edit_pages");
     	     
              renderURL .setParameter("groupId",value);
    	         renderURL.setPortletId('&lt;%=themeDisplay.getPortletDisplay().getId()%&gt;');
        	      alert(renderURL.toString());
    
      		 
     	    });