• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

More than one portlets in a single war file

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

Can anyone please tell me when do we need to package more than one portlets in the same war file?

Thanks in advance
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More than one portlets are packaged in the same war
- When we have related portlets which need to share the same context which
contains all resources such as images, properties files and classes.
- Theres a need to share resources and send messages among the portlets to communicate events.
 
Dorothy Taylor
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And what if two portlets have the same JSP or the formbean? In this case also do they need to be in the same war file
 
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
Yes, if two portlets have the same JSP, they need to be in the same war, that's for sure.

A single portlet application is delivered as a war file, but that application may have many portlets within it. An accounting application might have one portlet that allows you to file, one that allows you to find tax information, one that allows you to manage receipts, and anothet that allows you to file income. All might be different portlets, but packaged together in a common war file.

Many tutorials show only one portlet per war, but when you get deep into portlet programming, many portlets per war becomes the norm.

-Cameron McKenzie
 
author
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

here is an example - one war, five portlets. - Spring MVC portlets in Liferay

1. Download plugins-sdk with Spring MVC portlets from http://liferay.cignex.com/sesame/plugins-sdk.zip
2. Unzip plugins-sdk.zip; Find build.Jonas.properties
3. Rename build.Jonas.properties into build.${username}.properties.
4. Update entry (app.server.dir) in build.${username}.properties. Let it point to Liferay Tomcat directory. For example: app.server.dir=C:/training/tomcat.
5. Drop �build.xml� at /portlets to Ant view.
6. Development �
7. Run Deploy at Ant view if you are ready.
8. Test portlets at Liferay runtime �
 
Dorothy Taylor
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Cameron Wallace McKenzie:
Yes, if two portlets have the same JSP, they need to be in the same war, that's for sure.

A single portlet application is delivered as a war file, but that application may have many portlets within it. An accounting application might have one portlet that allows you to file, one that allows you to find tax information, one that allows you to manage receipts, and anothet that allows you to file income. All might be different portlets, but packaged together in a common war file.

Many tutorials show only one portlet per war, but when you get deep into portlet programming, many portlets per war becomes the norm.

-Cameron McKenzie




In this example, why do we need to package all these accounting portlets in a single war? Why can they not be independent portlets?
 
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
As I always say, there are no right answers, only wrong answers. As long as we don't get a wrong answer, we are okay.

A war should contain a set of common, related components - just like in a large Servlet & JSP application. If you have a bunch of HR or Accounting portlets, it makes sense to deploy them in a single war. Furthermore, being in a single war makes it possible to have then share information through the PortletSession's application scope.

If you have IBM portal, look at all the portlets IBM provides that are in a common, single, war. I think Lotus Notes has like 10 portles that provide Notes functionality, all of which are sensibly packaged in a single war. After all, it' be annoying to have to deploy 10 war files to get 10 commonly related portlets that provide Notes functionality.

-Cameron McKenzie
 
Dorothy Taylor
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok, understood that, but just one more small query...as you said that similar portlets can be grouped as a single war. Now, how should the implementation be for the action classes and jsp's of such portlets? I mean even when the portlets are packaged in one war, should they have independent action classes and jsp's unless they are absolutely alike, or should we check in the SAME action class if portlet "A" triggers this action do something and if portlet "B" triggers then do something else
 
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
Even though they might be packaged together, you can still develop them as though they were independent portlets.

It becomes simliar to a Servlet/JSP application in that regard. If you have a LoginServlet that forwards to a successfullogin.jsp page, that Servlet and JSP page doesn't need any knowlege of a Servlet named GetAccounBalance or a JSP named displaybalance.jsp.

They may be in the same war file, and even the same folders, but they need not interact with each other. In that regards, the portlets become similar to Servlet and JSPs packaged in a common war.

-Cameron McKenzie
 
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic