Keith Sader wrote:
> IMO this is a design smell of the presentation layer.

Maybe.  And from the name of the class, I can see why you questioned that.

OrderRulesBean.getSmallOrderFeeLimit()

This static method is returning a property from a properties file that will be included in a message to the user. This class provides a convenient way for java classes to reference a single instance of this property.

From what you said, I could create a page display backing bean and expose it through there. Good idea if it works. But, I was wondering if there was a more general way without having to re-expose it.

In my particular case, I might have a problem accessing the request scoped page display bean. The message that I am displaying to the user is located in an internationalized message (JSP) file that will be imported to the page using <c:import> tag after fetching the page URL using <fmt:message> tag to get the URL from the ApplicationResources.properties file. I need to insert the value from the static method in the text contained in the imported file.

Is there is a direct way to access the static method without fetching it from request scoped variable or object? Another post said there is a nonstandard Struts tag library that will work.


BTW, what is best practice in Struts when providing data to JSP files?

1. Create a display backing bean that contains all of the objects that will be used and store that in a single requested scoped variable?

2. Store individual objects and values in requested scoped variables?

Keith, thanks a lot for your feedback.

Keith


Keith Sader wrote:
IMO this is a design smell of the presentation layer.

My suggestion would be to refactor these items down to the
'business-layer' and then have your actions put the results of that
layer into the form/display bean.

Then the .jsp could just look like <c:out value='${order.smallOrderFeeLimit}'/>

There may be more to this with your particular site, but that's a
first off-the-cuff guess.

hth,


On 2/8/06, Keith Fetterman <[EMAIL PROTECTED]> wrote:


We are converting old JSP pages to Struts and JSTL and I am running into
a problem.  On the old JSP pages, we have some calls to static methods
in scriptlets and runtime expressions.  On the new JSP pages, we have
disabled scriptlets and runtime expressions.  Here is an example:

The old code will have an expression like:
<%= OrderRulesBean.getSmallOrderFeeLimit() %>

What is the best way (best practice or easiest to implement) to access
static methods in the JSP pages without resorting to runtime expressions?


--
Keith Sader
[EMAIL PROTECTED]
http://www.saderfamily.org/roller/page/ksader
http://www.jroller.com/page/certifieddanger

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
-----------------------------------------------------------------
Keith Fetterman                          206-780-5670
Mariner Supply, Inc.                     [EMAIL PROTECTED]
http://www.go2marine.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to