PDA

View Full Version : Making web portal with spring


depy
Jun 9th, 2008, 10:34 AM
I started with JSF then switched to spring + hibernate.

Now I mapped all the classes to the DB tables. When I finally wanted to start building the portal, I realize that I dont know how to start.

My idea was to, do simple little controllers for examples the controllers that return latest news, user by id, user by name and so on and then somehow join all this fragments into a single page.

So. I tried including (on my index.jsp) with jsp:include for example (MultiActionController) news.htm?action=latest but this doesn't work somehow.

The news.htm view with action=latest works fine by the way. Am I missing something? What aproach should I use? Any keyword I should google?

I was thinking about portlets also. Seems like a well fragmented aproach, but some friend told my portlets are not that popular anymore...

Please help. I'm desperate!

spiff
Jun 9th, 2008, 10:44 AM
Seems like a good case for using portlets and a portal container. All this logic of aggregating content from different sources and personalizing display on a user per user basis is already implemented by the container. Try reading more about JSR-168 portlets and try out different portal servers such as JBoss, Liferay or BEA (stay away from IBM).

In my area portals are all the rage, so I don't know why your friend is saying that they're not popular anymore. Maybe he's referring to the fact that Microsoft SharePoint is gaining a lot of market share at the expense of Java portals?

Cheers,
GB

depy
Jun 10th, 2008, 05:47 AM
So there's no way to do that in spring easily?

My boss is gonna kill me if I change the development environment again... :)

The spring has also portlets right? How about using springs portlets? Any first hand advice?

spiff
Jun 10th, 2008, 09:44 AM
I have very few details about your project as a whole so I can only give you lines of thought. Choosing to go with a portal approach instead of the standard servlet-based approach is a major architectural decision and will have a huge impact on your system's implementation. I suggest you research this thoroughly and discuss this with your technical lead and project manager before starting anything.

The only scenario you mentioned seems to require some content aggregation, something for which portlets are a natural fit. However if there is only one such scenario in your application, it may be better to do the aggregation in this one controller and stick with a standard webapp.

Spring does offer Spring Portlet MVC for developing portlets. I've done some prototyping with it, it seemed to be a simple and straightforward API and I wouldn't hesitate to use it for a production application.

Cheers,
GB

depy
Jun 10th, 2008, 12:24 PM
Well, basically my project is just some standard public web portal.

With registration, login, news of some kind, user profile, friends lists, some downloads of stuff and we thought of some kind of approach to make a community part like forums, comments and so on.

So nothing new, but as I said, I'm kinda new to web development, and had a hard time figuring out spring so I dont want to switch to something totally different and start over.

Are spring portlets meant to be used with spring controllers? Cause that could be very usefull then since I have most of the controllers defined already.

And I hope that u can disable that features of moving, closing portlets and so on.

spiff
Jun 10th, 2008, 01:56 PM
The word "portal" is often misused: to some it's a technical platform (such as IBM WebSphere Portal) that offers content aggregation and user personalization services, to others it's simply a sophisticated way to refer to their web site which is built using a servlet-based model. Just because someone is talking about a portal doesn't mean it's executed inside a JSR-168 portlet container.

What you're describing could be implemented with or without portal technology. The decision is up to your team and shouldn't be taken lightly.

The Spring MVC and Spring Portlet MVC APIs are quite similar and follow basically the same design principles, but you cannot simply drop a Spring MVC controller in a portlet container. Spring portlet controllers make the distinction between the render and action phases (something that simple web controllers do not), request and response objects are different, user sessions work differently, etc.

You can use other parts of the Spring portfolio even when you're not using their own portlet MVC framework.

Features such as moving and resizing portlets depend on the portlet container and not the API itself.

Cheers,
GB

depy
Jun 10th, 2008, 03:49 PM
I guess i found what i've been looking for: Chaining controllers. Looks just like the thing I needed.

I've read also that interceptors can solve this problem?



---------------------------------Old post-----------------------------------------------
Well, I really dont need those features such as resizing, moving and so on.

So my main problem is how to integrate not one but more information (content) on a single page. Should I use "one big controller" and "one big jsp view" for displaying login, news, menu and so on at the same time?

My real problem is cause I dont know how to begin building the whole thing together part by part.

And terms, url, books I should look? I've heard about Tiles, is that the thing I need?

I hope you get my point. I'm pretty bad at explaining.... :D