aspose file tools*
The moose likes Portals and Portlets and the fly likes URLs in a Portlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "URLs in a Portlet" Watch "URLs in a Portlet" New topic
Author

URLs in a Portlet

John Lincoln
Ranch Hand

Joined: Feb 11, 2003
Posts: 192
Hi,

I have a Login Portlet. The Login portlet has 2 links "Forgot Username" and "Forgot password", which themselves are portlets ( i mean "Forgot Username" and "Forgot password"are protlets).

when the user-clicks on the links, it should take to intial-JSP of corresponding portlets

How this can be done ? Please help

thanks
Cameron McKenzie
Greenhorn

Joined: Feb 24, 2005
Posts: 12
John, John, John, where do we begin? Is this a live app, or just a proof of concept type scenario.

One thing that makes me a little nervous is asking a user to log in. One of the reasons for using the portal is the ease with which we can delegate the task of user management to the portal. You should use the portal to log the user in, taking advantage of the massive user management facilities provided through the portal. I believe the request object has a method that gives you the name the user used to log in.

Now for the idea of one portlet calling on another portlet. You're thinking in too much of a Struts/JSF/Servlet state of mind. This isn't really how portlets are supposed to work. I mean, you want the portlet the user used to magically disappear (I don't think that's possible), and then have two new portlets just add themselves to the same portal page, and display with information provided from the first portlet. I think you're going to have to redesign the portal to achieve this. It's not supposed to work that way.

I don't mean to be trite, but you really have to change your thinking when you move to the portal.

Here's what I might do, if you are totally committed to not using the portal user management facilities.

Create a portlet that logs the user on. Have three JSP pages: one is the landing page (index.jsp), the successful login page, success.jsp, and the loginfailed/request password page, loginfailed.jsp. When the portlet first displays, you display the landing page. If they log in successfully, you send the to the success page, and if login fails, you send them to the loginfailed.jsp page. That alleviates the need to have portlets displayed and removed from the page.

For some tutorials on portlet development with JSR168, check out my free tutorials: Free Multimedia Tutorials on Portlet Development

Please write back and tell me how this does or not fit into your current scenario.

-Cameron McKenzie


Where is Springfield? <a href="http://www.pickeringisspringfield.com" target="_blank" rel="nofollow">http://www.pickeringisspringfield.com</a><br /> <br />Portlet Tutorials & Java Certification mock exams: <a href="http://www.scja.com" target="_blank" rel="nofollow">http://www.scja.com</a><br /> <br />WebSphere Stuff: <a href="http://www.pulpjava.com" target="_blank" rel="nofollow">http://www.pulpjava.com</a>
John Lincoln
Ranch Hand

Joined: Feb 11, 2003
Posts: 192
Hi,

Thanks for the email and valuable Suggestion. I was completely wrong with my intial desgin.

I followed your suggestion and made LoginPortlet has one single unit. Forgot username and Forgot password are just jsp pages and when the user clicks on the links, these pages are rendered.

I visited your web-site. This has some excellent resources on portlets. Please keep up the good work


thanks
John Lincoln
Ranch Hand

Joined: Feb 11, 2003
Posts: 192
Hi McKenzie,

I have a question regarding the rendering view. Right now, i am setting different RenderParameters to render different views. This should be the approach irrespective of how many views we have ?

Right now i have 8 to 9 views.

Please throw some light

thanks
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

You have just hijacked your own thread, changing the subject halfway through.

One of the frustrating aspects of portlet development is the fact that the portal only allows a portlet to have one controller, essentially, the class you create that extends GenericPortlet. What happens when you have a bunch of different views? This one portlet turns into a front controller, and becomes bulky and awkward, not to mention difficult to maintain.

Trust me, you're not the first one to run into this problem.

For relatively simple portlets that are used for mild navigation, and largely the display of content, a class that extends GenericPortlet is great. For more complex, wizard-like portlets, or portlets with many navigational states, you have to start looking at moving towards a framework portlet.

People have worked hard to port both the Struts and the JSF framework to a portal environment. IMHO, JSF is much easier to get working as a portlet than Struts, and that's coming from a long-time struts developer. But, with these frameworks, you can create a multi-page, multi-state portlet as though you were creating a complex, web based application. Plus, these frameworks also provide error handling, custom tag libraries, error feedback, memento patterns, and all sorts of other great things.

I've actually just written a few tutorials on how to get a Struts portlet or a JSF portlet to work in a JetSpeed2, JSR-168 environment. If that's the route you think you're going to have to go down, let me know, and I can get you a copy of the tutorials.

Let me know what you think.

-Cameron McKenzie
John Lincoln
Ranch Hand

Joined: Feb 11, 2003
Posts: 192
Hi Mckenize,

Thanks again for the reply and suggestion. I think portal framework approach would be good. Can you please provide the tutorials or the link for the same.

I really appreciate your help and thank you for all the valuable suggestions.

Let me know

thanks
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

I just posted the tutorials on my website. Here they are:

Creating a JSR 168 Struts Portlet

Tutorial on Creating a JSR168 Java Server Faces Portlet (JSF)

I hope that helps!

-Cameron McKenzie
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: URLs in a Portlet