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

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.


Well is it possible to just put this in as another property of what's
being displayed on the page currently so that
${order.smallOrderFeeLimit} just delegates that call on the get to
OrderRulesBean.getSmallOrderFeeLimit()?

I have thought of that, but I was hoping not to because it appeared redundant and bloated the class.



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.


Ow, that made my head hurt :-)

This stuff makes my head hurt all of the time :) Way too much stuff to master to roll out Web applications.


Ok, since this app is internationalized, I'm guessing you have your
.en, .fr, etc. files all ready to go?  If I'm reading this right, it
looks like your app needs an internationalization effort put into it? Maybe I misread.

That is correct. As we cut over to Struts, we have been internationalizing the messages, other template page text and text images.


Is there a reason you're not using the Applications.resources.(country
code) files to do this sort of thing?  Again, I'm probably missing
something.

I may not be doing this the right way. Simple messages live in our ApplicationResources.properties file. Right now, we are only doing english, which is the default.

But, I didn't know what to do with more complex messages, which may be multiple paragraphs, with HTML, images, links, etc. And may contain Struts/JSTL tags too. So what we have done is created a directory in our application:

/messages/en/

In that directory, we place JSP files that contain the more complex messages. In the ApplicationResouces.properties file, we specify a URL to the file containing the complex message.

Then in the original JSP page, we use the <fmt:message> tag to get the URL and a <c:import> tag to import the file into the original JSP page.

Is there any easier way?

I have the Struts Recipes Book and Jakarta Struts Cookbook if you can point me there.



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.


FWIW, I'd stay away from those, but it might work for your situation.


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


Good question, I know the technique I prefer is your #2 item below,
but that might not be the best practice in your situation.

Its the technique I prefer too because it cuts down on creating extra classes.



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, doubly thanks for your help.  I really appreciate it.

--
-----------------------------------------------------------------
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