For the most part you are correct. However, it is a little more straight forward than that.

Logic should be wrappered in a logic object. The Tag Library can bridge the presentation to this generic logic. This is so that the generic logic can be used universally from either a presentation screen or from another logic object that needs the same functionallity. This is good practice because it allows you to write the code once and reuse it in many places. This saves on memory, Maintenance time, Development time, etc.

The reason you want to extract presentation from logic, is because many companies rebrand themselves often on the internet. New look and feel keeps thing nice and fresh, but is a nightmare if you have to rewrite your applications just to take on a new layout. Additionally, after a site is released, you often find the users do not use the application as you expected during development. By rearranging the screen layout and application flow, you can make the users more productive and generally happier. If you tie your logic to your screen this becomes much more complex.

The key to any object oriented language is to develop small compartmentalized objects. These objects should focus on just the functionallity it needs to complete its task. A fell defined set of interfaces should handle getting the information to and from the little back box.

This is where Struts, Taglibraries, JSF, etc come into play.

Inactive hide details for peru cheppanu <[EMAIL PROTECTED]>peru cheppanu <[EMAIL PROTECTED]>


          peru cheppanu <[EMAIL PROTECTED]>

          08/29/2005 12:41 PM

          Please respond to
          "Struts Users Mailing List" <user@struts.apache.org>

To

user@struts.apache.org

cc


Subject

core struts -- best practise fundementals

Hi all,

I am trying to understand the motivation behind seperation of logic and
presentation in struts framework. I was wondering if any of you can
provide some light if I am thinking in right direction.

Now, if you write scriptlets in JSP, that is a bad practice.., however
if you hide that functionality in a tag class and implement that tag
like struts tags or any other tags.. thats a good practice.

For example, I want to send a concatenated string instead of a hashmap
to display as per key-value relationship. I meant send "[EMAIL PROTECTED]"
string rather than a hashmap and want to parse it for display. If I write a
scriptlet that I use to substring and display only that user is
concerned with -- that is bad practice. If I use a tag lib that looks more
like
<logic:substring name="hashArr" digits="4">, --> good.

Am I getting this whole thing wrong? Pls excuse if I sound too stupid
and this is my first post here..

--Ashrita



---------------------------------
Yahoo! Mail for Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.

Reply via email to