?
Solved

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

Posted on 2004-11-23
9
Medium Priority
?
211 Views
Last Modified: 2010-04-01

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.
0
Comment
Question by:jbaisden
9 Comments
 
LVL 8

Accepted Solution

by:
kiranhk earned 1000 total points
ID: 12659589
try this..

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

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

Author Comment

by:jbaisden
ID: 12660430
I'll give it a try but I really can't use the <% ... %> tags.
0
 

Expert Comment

by:ClazzeFlits
ID: 12668485
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:boonleng
ID: 12674808
Not sure why you cant use <%...%>, but if you really dont want to use scriptlet,
then you might consider using JSTL tag.
0
 
LVL 1

Expert Comment

by:Ortokobold
ID: 12677810
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
 

Author Comment

by:jbaisden
ID: 12695742
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
 
LVL 29

Expert Comment

by:bloodredsun
ID: 12830795
Use JSTL
<c:if test='${sessionScope.javaBean.myValue > param.RecordCount}'>
     <!-- Your meessage -->
</c:if>
0
 
LVL 8

Expert Comment

by:kiranhk
ID: 13405374
can you close this question... its been more than 3 months...........
0
 

Author Comment

by:jbaisden
ID: 13419253
Sorry that I hadn't closed this thread yet. Thanks for your help guys.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I came across an unsolved Outlook issue and here is my solution.
Over time, the online landscape has altered considerably, but that’s nothing compared to the up-and-coming trends that will shape the web design industry in the coming year. Keep reading to find out which trends will shape B2B web design in 2018.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question