Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

how to forward from one portlet to another?

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I'm starting learning about portals and I've developed a very simple portlet app. Now I want to add more portlets but I did not find a way to forward from one portlet to another.

Can somebody give me an example?

Daniel
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope, I can't give you an example, because you can't do it.

Essentially, what you are saying is that you have a portal page, with a portlet on it. A user has intentionally added a portlet to that portal page. And what you want to do is, when a button or something is clicked, flip out the portlet a user wanted on their page, with another portlet that you are deciding you want the user to see. Nope, that's simply not allowed.

Don't mean to be glib, but portlet development really requires a mind shift. You have to totally rethink how you develop applications.

However, what you CAN do, is perhaps, when a button is clicked, display a different JSP to the user that displays different content. Here's a very simple, free online tutorial that talks about forwarding to JSPs from a portlet:

Free CBT Tutorial on Portlet Development: Forwarding to JSPs from a JSR168 Portlet

Alternatively, if you have a number of complex page transitions, you might want to use a Struts or Java Server Faces portlet. Bridges are avaialbe from apache. Of course, if you're a new to portlet development, you might not want to overly complicate things by integrating the struts portlet bridge, or JSF portlet bridge into your application, but it's always an option. Here are some tutorials on creating the struts portlet, and the JSF portlet:

CBT Tutorial on Creating the JSR-168 Struts and JSF Portlets (deployed to LifeRay & JetSpeed)

Good luck, and have fun developing for the portal.

-Cameron McKenzie
 
Daniel Amadei
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

Thanks for the quick help!

I got a look on the bridges for the jetspeed portal but as I'm learning portal basics, I prefer to study pure portlets for now.

That's what I was wondering, and I have another question: if I have several pages and a 'pageflow' after I have forwarded to some pages, if the user clicks refresh in the browser, how will the portal know that the user was in page 5 of my flow of 6 pages? Will I have to control this manually in the portlet?

Thanks,
Daniel
 
Cameron Wallace McKenzie
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with you that you should stay away from the Struts and JSF bridges for now. Master the JSR168 API first, and then move onto the portlet frameworks when the need arises. Framework portlets like Struts and JSF should be the exception, not the rule.

With complex, multi-page portlets, indeed, flow control and navigation through multiple pages will be a process that must be controlled by the developer. When a portlet is rendered on a page, be it a refresh or a link click, the doView method is invoked. Some type of flag must be placed in the session or something to indicate what is a legal page transition for the portlet, and what page a user should see. Once you start getting six or seven levels deep in a portlet, it can become very complicated, and frameworks to start to become more compelling.

Happy Portal!

-Cameron McKenzie
[ March 22, 2007: Message edited by: Cameron W. McKenzie ]
 
Daniel Amadei
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Cameron,

Thanks a lot. I imagined that but I was trying to convince me that this was not the case and we could program portlets as we do with servlets.

I'll get some hands on samples and after that I will go to Struts portlets as I do not like JSF at all

[]s
Daniel
 
Cameron Wallace McKenzie
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't like JSF at all, eh?

I'm somewhat new to JSF, with a long Struts history, but from the portal perspective, it looks like the direction is very much JSF based. JSF seems to integrate much easier into a JSR168 framework than Struts does. From IBM's standpoint, JSF with JSR168 very much seems the direction. Can't say with Liferay or JBoss or any of the others though.

Better keep an open mind.

-Cameron
 
Daniel Amadei
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Cameron,

My mind is open, don't worry...

When developing pages in HTML and using the form items as JSF, it works fine like Struts or other frameworks (except for the backing beans which I believe make you APP a mess).

But when we have to develop the entire page using just JSF tags, without using HTML, this reduces my productivity a lot as when we develop in pure HTML the webdesigner does all the dirty work, but when I get a prototyped page already built in HTML I have to recreate it in JSF, I'm wasting the company's money. Not to mention that we get locked to the renderer of the implementation, which makes a lot harder to achieve simple layout changes your user may ask.

That's why I do not like JSF very much, even tough I had to use it in one project for a large company here in Brazil I still believe Struts and especially Struts 2 are much more productive.

Regards,
Daniel
[ March 26, 2007: Message edited by: Daniel Amadei ]
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Cameron,

Forwarding to JSPs from a JSR168 Portlet
this link is broken now,can you provide some other references please.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic