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

Design Patterns and Struts

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

Just to get a better feel for it, are there any Design Patterns that are good to adhear to in Struts? From my 10 foot view it appears like Struts was badly designed with endless extentions of the DispatchAction and Action classes, (but what do I know...I guess that's why I'm asking...)

Also what do you call those things in the taglibs that go ${var.prop} as when I look in the documentation they don't really seem to be there. Are those things in the page scope?

Thank you,
Andrew Leer
 
Andrew Leer
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay so these things are called (${ }) EL (Expression Language).

Alright I can see that. But now I have another question. Why can't you access constants from EL? Yes, yes, I know there's an artical on it over at the Jounral this week. And the guy who wrote it is successful in thawrting that with the tag-lib he wrote. But...

There has to be a good reason/alternative to WHY it is that you can't access constants from EL.

So in summary these are my questions:

  • What if any design patterns should you utilize when programming in Struts and dealing with Actions?
  • Why is it that you cannot you access constants from EL (Expression Language)?

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

    What if any design patterns should you utilize when programming in Struts and dealing with Actions?


    One must never lose sight of the fact that a Struts application is a J2EE (I guess the correct term now is "Java EE") web application. It's got a few utilities and cool tricks, but it remains a J2EE application. As such, the entire list of J2EE patterns applies to a Struts application. Here is the URL to the J2EE Patterns developed by Sun Microsystems:

    http://java.sun.com/blueprints/corej2eepatterns/index.html

    The "Front Controller" pattern is already implemented for you by Struts, but all the others are good candidates for a you to use in your applications.

    Although Struts is indeed an MVC (Model/View/Controller) framework, the assets it provides really only cover the view and the controller. Building the model and accessing the model through the controller is up to you. To do this, you can definitely benefit from the patterns mentioned in the link above.

    Why is it that you cannot you access constants from EL (Expression Language)?



    That's the $10,000 question. Many of us wish EL had better support for constants, and are pushing for it in the next release. Without being able to speak for the developers of JSTL and EL, my guess is that the answer has to do with the fact that EL was developed to work exclusively with JavaBeans. It was not designed as a substitute for Java code, but a way to easily and conveniently access JavaBeans from within a JSP. Constants are not part of the JavaBean spec, and I suppose this is one reason they were left out. The reality is, most of us rely heavily on constants, and it's not at all convenient to have to jump through hoops in order to use them in EL.

    I hope you're clear on the fact that Struts and EL are entirely separate. EL and JSTL are part of the JSP spec, while Struts is a web framework built over the Servlet and JSP specs.
     
    I would challenge you to a battle of wits, but I see you are unarmed - shakespear. Unarmed tiny ad:
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic