0

ZK Portlet URLs

asked 2008-06-17 14:29:21 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=5038086

By: tombol

Hello,

I've been trying to find a solution regarding the URLs inside a ZK portlet without any luck, the only thing that is closer to a solution is to use the zul JSP tag library but again without being able to do much...

Is there any solution to a simple redirect to an other zul page inside the same portlet?How can anyone get renderrequest and renderresponse like servletrequest and servletresponse using getNativeRequest and getNativeResponse respectively..
Am I missing something???


Thanks..

delete flag offensive retag edit

8 Replies

Sort by ยป oldest newest

answered 2008-06-18 09:03:56 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=5039690

By: kvegter

I don't know exactly what you want to do. Here some of my experiences:

The zul page is running in its portlet war, this means that the war context is probably different than the portal context. This can give problems in finding resources (images and zul pages) in your war. In my environment (liferay portal and portlet war's on tomcat) it is sufficient to put a slash "/" for relative urls.
For instance you have the following structure:
myapp/index.zul
images/excel.gif

On the index.zul page there is an imagemap with a src attribute pointing to the excel.gif.
In my case using "../images/excel.gif" will fail because the browser tries to resolve this url to the portal context.
When I use "/images.excel.gif" it works fine.

I suppose it is the same zul pages.

A remark when you want to load different zul pages in the same portlet use the "include" component. This component has also a src attribute to point to a zul page. Maybe you will need a zul page where you portlet defaults to with <include src="/myapp/index.zul">


link publish delete flag offensive edit

answered 2008-06-19 08:43:03 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=5041402

By: tombol

First of all I want to thank you for your concern and your answer!!

I don't know if you have the same problem I handled with jboss portal, the DHtmlLayoutPortlet does not work for me if i want to include various zul pages with the include component so i created an other Portlet Class based on GenericPortlet and i use Portlets.include to pass the requests.(I don't know if this may be a solution for someone else :-) )

But the main problem that I'm looking is that how do i redirect to another zul page???? In a web app i use Executions.sendRedirect(theURL) and everything works just fine. But as far as a portlet is concerned I cannot redirect that simply....
I'm trying to get renderRequest and renderResponse to use the PortletRequestDispatcher but I can't find these objects anywere. The nativeRequest and nativeResponse return ServletRequest and ServletResponse respectively. aren't these functions suppose to return renderrequest and renderresponse when we are in a portal/portlet JSR-168 environment?? And another thing that I noticed is that these two objects should be as attributes inside HTTPServletRequest with the keys "javax.portlet.request" and "javax.portlet.response" but they don't exist..

Another issue is that how can i handle the portletmodes of a Zul portlet??With more detail how do I pass for instance windowState=maximized in order to maximize a specified portlet??

:-) Please give me some guidelines or if you have something to suggest to solve these problems if possible..

My suggestion would be a function "under" Executions for instance to redirect while being inside a portlet environment and passing parameters like windowState or handle actions..

when writing portlets in JSP there is a tag library <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %> to use and after that you specify <portlet:defineObjects /> and after that you can easily use renderrequest renderresponse, create URLs actions and in general handle the portlet functionality..

Thank you again. I'm looking forward for your answer because these issues are bothering me for some time now.. :)

tom.

link publish delete flag offensive edit

answered 2008-06-19 10:10:39 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=5041579

By: kvegter

Why is the include component not working for you?
Are you redirecting to zul portlets in other portlet war's?

About doing the redirect i have the following thoughts.
My experiences with an other portal was that i only can do the redirect in the portlet processAction on the ActionResponse object.
This makes sense because when the doView is called (with renderRequest and renderResponse) the portal assumes that your portlet serves content.
In a portal point of view it makes sense to allow only a redirect in the processAction because at that moment no renderrequests are fired to all the portlets on the portal page.

I don't know if the DHtmlLayoutPortlet has an processAction implementation --> Portlet model is different than the Ajax Model!
Also you should use the proper portal parameters to pass the parameters to a portlet (use the portlet actionurl or renderurl.

maybe this helps.


gr Kees




link publish delete flag offensive edit

answered 2008-06-19 11:06:52 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=5041669

By: tombol

No, I redirect to zul pages in the same war, but its ok o overpassed this problem.

Hmmm You are right but again from where do I retrieve actionURL and renderURL is there a function to do such a thing? whith renderURL it would be possible to do my job and process actions with actionURL. DHtmlLayoutPortlet does not have a processAction implementation but I can write one i think..

what is more, renderResponse object gives you some functions like createRenderURL and createActionURL() that return PortletURL objects to create proper hrefs inside portlet is this possible to do it inside zul pages and/or inside code?


Thanks again.

link publish delete flag offensive edit

answered 2008-06-20 12:09:19 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=5043978

By: kvegter

It is always difficult in a portal to get the instance id of another portlet which you must? have for generating the correct actionURL or renderURL.
In most cases you have to use a portal-specific api to get these, or figer out how the portal builds those urls (trial and error). When you have the correct construction of the url the parameter will be passed to the portlet. This is not something ZK can provide...


I'am interested on how your zk application works.
>From your comments I see that your application is build on portal
>portlets on
portal pages and zul pages?
In my case I only have one zul startpage per portlet. Within this zul page I can load any available zul page available in the portlet war.
In that way I do zk only in ajax manner and I have no interference with the ajax model and the request/response model of a portal.
I only use the zk_page parameter as portlet-preference parameter.

gr Kees

link publish delete flag offensive edit

answered 2008-10-19 14:21:32 +0800

jlombardo gravatar image jlombardo
12

I've been developing JSR-168 portlets the old fashioned way for quite some time, but I'm a newbie at ZK. I must be incredibly stupid but I can't get even a simple page to display in my portlet container, which is Pluto. Can anyone share some code for displaying a simple zul page in a portlet?

link publish delete flag offensive edit

answered 2008-10-20 01:32:13 +0800

robbiecheng gravatar image robbiecheng
1144 2
http://robbiecheng.sys-co...

Here is a how/to about deploying portlet on pluto.
http://en.wikibooks.org/wiki/ZK/How-Tos#Pluto

/robbie

link publish delete flag offensive edit

answered 2008-10-21 16:33:24 +0800

jlombardo gravatar image jlombardo
12

Thanks, Robbie. That helped a lot. I can now display a ZK stuff on a portal page. Much appreciated :)

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2008-06-17 14:29:21 +0800

Seen: 1,304 times

Last updated: Oct 21 '08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More