Forums Login/signup

Where does MVC determine you generate string content?

+Pie Number of slices to send: Send
Hi There -

We have a debate on our project about where string content should be generated . If there's a message that should be displayed to the user, it's easier for the action class to save a string in a form bean and have the jsp retrieve the string from the bean and display it. However a member of our team has convinced the team lead that we should merely pass flags in the bean and the jsp will have a series of c:if statements that will check the flags and display the appropriate string message. that way all string content is in the presentation layer and not in the model.

I prefer the first method because there's less coupling between model and presentation and it's more flexible for adding new messages.

How would an MVC expert decide this?

Steve
+Pie Number of slices to send: Send
MVC expert? Is there such a thing? I think that most Struts developers lump Form Beans into the View category. It is not the Model. The Model is more your database or business objects.

Then again, I would never advocate blindly following a pattern. Stop and think about how much additional work the approach that your fellow team mate causes. Patterns are in place to make your job easier, not to make more work. Adding all that logic to your JSP seem foolish to me. My view is that a JSP should be as close to HTML as possible and that anytime you can remove logic from a JSP and move it into the Action Form you are better off.

If your tech lead needs a pattern to justify your actions, tell him that you are using the View Helper pattern: http://java.sun.com/blueprints/corej2eepatterns/Patterns/ViewHelper.html

- Brent

reply
reply
This thread has been viewed 649 times.
Similar Threads
Mark's MVC design - all controller methods private?
Business Tier + Persistence Tier
Topic: Struts and MVC. Question: how usually are working you?
When using MVC, to what degree should a model be tailored to a view?
Is this MVC?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
More...

All times above are in ranch (not your local) time.
The current ranch time is
Jun 30, 2025 11:42:49.