Struts resource question

T

Tom Ewall

I understand that when writing jsp's it's standard practise to use
ApplicationResources for different properties you'd want to store for
the application. Is it also standard practise to use this file for
properites you'd want to store for the server side classes as well?
(like the Action classes).
 
S

Sudsy

Tom said:
I understand that when writing jsp's it's standard practise to use
ApplicationResources for different properties you'd want to store for
the application. Is it also standard practise to use this file for
properites you'd want to store for the server side classes as well?
(like the Action classes).

I just use set-property elements, e.g.:

<action ... >
<set-property name="defaultUser" value="joe" />
<set-property name="maxMsgSize" value="10K" />
</action>
 
T

Tom Ewall

Perhaps I wasn't clear. I am wanting to use a properties file for
some server side classes I'm writing. I'm thinking I can use the
ApplicationResources.properties file for this, since it's already
being used for this purpose for the jsp's. I was just checking that
this wasn't against some Struts standard practise.
 
S

Sudsy

Tom said:
Perhaps I wasn't clear. I am wanting to use a properties file for
some server side classes I'm writing. I'm thinking I can use the
ApplicationResources.properties file for this, since it's already
being used for this purpose for the jsp's. I was just checking that
this wasn't against some Struts standard practise.

Standard practice is that the properties files are used for messages.
Check out the message-resources element in the struts-config.xml file.
It's also useful for i18n. IMHO it's not the right place for application
parameters. That's why the set-property element exists.
It could be confusing to maintenance programmers if you use
MessageResources.getMessage() to retrieve parameters, don't you think?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top