STRUTS JSP question; trying to use application.resource value inside logic tag for value param; is this possible?


Hi all. I am attempting to do the following:

<logic:greaterThan name="RecordCount" property="errCode" value="<bean:message key='anumbervalue' />" >
      <bean:message key="amessagetodsiplay" />
</logic:greaterThan>

Pretty much I need a message to be displayed depending on the number of records returned from a query. This min # of records that must be retreived to receive this message is stored in my application.properties file. I am trying to use this value as the value to be compared to in the logic:greaterThan operation.
The actual names of the keys have been changed for privacy reasons.

I have tried displayed the messages by themselves and that works fine so retrieving the values these keys is not the issue. The above code also works if I hard code the value inisde the value attribute, but that just sends a shiver down my spine.

Any ideas are welcome. Need any and all thoughts ASAP. Thanks a bunch. Later.
jbaisdenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kiranhkCommented:
try this..

    <bean:define id="theNumber" value="<bean:message key='anumbervalue' />"/>

<logic:greaterThan name="RecordCount" property="errCode" value="<%= theNumber %>"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jbaisdenAuthor Commented:
I'll give it a try but I really can't use the <% ... %> tags.
0
ClazzeFlitsCommented:
Because Struts is built on top of JSP/Servet technoloy, you can always fallback on the use of JSP tags. So using <%=.....%> can't be the problem.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

boonlengCommented:
Not sure why you cant use <%...%>, but if you really dont want to use scriptlet,
then you might consider using JSTL tag.
0
OrtokoboldCommented:
You cannot use Struts tag inside another Struts tag. In this example: the "value" parameter which you pass to the "logic:greaterThan" has to be a constant value or a scriptlet - but it cannot be equation that you'll get by evaluating another Struts tag. In other words, you'll have to use scriptlet inside the "value" parameter. It can be as simple as "<%= anumber %>", but first you'll have to declare this variable:

<bean:define id="anumber">
  <bean:message key="anumbervalue" />
</bean:define>
0
jbaisdenAuthor Commented:
To clarify the decision not to use the <% %> is part of a standard decided on by the development team in an effort to use as little programming in the presentation layer as possible. This is not the cause of an error or anything of that sort. However, I see that we can not do what I am asking unless we use the <% %> so I will recommend an exception. One infinitesimal addition of programming to the presentation layer in exchange for immediate dynamic response seems a fair trade, but the worry is falling into this habit over and over and before long the presentation layer is obscured by programming logic. Blah. I'm preaching to the choir. Do you guys think this is going over board or would you say I am somewhat justified in this approach?
0
bloodredsunCommented:
Use JSTL
<c:if test='${sessionScope.javaBean.myValue > param.RecordCount}'>
     <!-- Your meessage -->
</c:if>
0
kiranhkCommented:
can you close this question... its been more than 3 months...........
0
jbaisdenAuthor Commented:
Sorry that I hadn't closed this thread yet. Thanks for your help guys.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.