JustDanyul
JustDanyul

Reputation: 14044

MVC and Java-EE

During the years, I grown quite the affection for the Model-View-Controller design pattern and the benefits it provides. But I'm struggling to make full use of these benefits when it comes to web applications.

If I was to create a component called UsersComponent, which consists of:

Then in Java Swing, You could easily do a class UserComponent which extended JPanel, and inside UserComponent, have you model, view and control classes. And you'll end up with a very easily re-uable component.

Now, what I would love to do, is to mimic this in Java-EE. String templates seems to provide a solution for this. BUT, with a added twist. I like web designers. And I would love to provide them with a opportunity of adding components without having to involve a developer or putting to much though into what entry point they should use.

For example, lets say we have a base page template, and the designer wishes to add the UserComponent component somewhere on this page. You will then need to populate the model, in most cases based on some request parameters.

So, here's the actual question. Does anybody know of a way, of determining which templates are included in a given template. So you could analyse this template at runtime (or rather every time its modified), and do the appropriate housekeeping in the main page controller?

Basically, so I could accomplish this:

Currently, the best solution I have been able to come up with is to have different servlets for different base pages, which exposes different subsets of functionality. But I'm not at all happy with this solution. It would be so much neater, if there was a possibility of handling it dynamically. Basically, having handlers for ALL supported components but only initializing/handling the ones which are actually needed.

I would love to hear your guys thoughts on this :)

** UPDATE **

I think my mentions of swing have confused this matter a little bit. What I would love to do is to create components, available to web designers though string templates, which they can then include in any given string template.

So i suppose it all comes down to this.

Does any body know a string template framework, which lets me determine at run time, which other string templates are included in a string template.

Upvotes: 0

Views: 716

Answers (2)

Tristan
Tristan

Reputation: 9141

If you want to do web Swing-like developpement with MVC (or MVP), you should try GWT

Upvotes: 0

Tristan
Tristan

Reputation: 9141

I'm not sure to understand your question : have you already tried frameworks like Struts 2, Spring MVC, or JSF ?

Is there something missing for you in those frameworks ?

Upvotes: 2

Related Questions