Solved

logic:equal with two variables

Posted on 2004-09-21
13
4,731 Views
Last Modified: 2008-01-09
Is there a way of comparing two session variables using struts  logic tag.
Or
we can only compare variables with constants
0
Comment
Question by:padmasri99
  • 5
  • 3
  • 2
  • +1
13 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 12115696
You should be able to do:

<bean:define id="valueA" value="<%= (String)session.getAttribute( "String one" ) %>"/>
<logic:equal name="valueA" value="<%= (String)session.getAttribute( "String two" ) %>">
   ...
</logic:equal>

which will compare two strings...  else, as you say, you will have to do it in 2 steps, OR doi it in JSP code...
0
 

Author Comment

by:padmasri99
ID: 12116101
I need to compare two bean property values and when I am doing it with bean define is setValue error in logic equal tag.Here is the code snippet.

<bean:define id="total" name="page" property="total" />
<logic:equal name="page" property="endValue" value="total">
  Do some thing
</logic:equal>

When I am defining "total" as constant in bean define it is working fine.
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12116140
Have you tried:

<logic:equal name="page" property="endValue" value="<%= total %>">

that probably wont work either though... I *believe* logic:equal only compares string values...

So as I said, you will probably have to do this with code...rather than the logic:equal tag
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

Author Comment

by:padmasri99
ID: 12116169
Yes I tried with scrilets (value="<%= total %>")also it also ended up in error.
Is there any way to do this with tags?
0
 

Author Comment

by:padmasri99
ID: 12116331
I am able to do this with JSTL
<c:if test="${page.endValue != page.totalValue}">
Thanks for the help
0
 
LVL 35

Accepted Solution

by:
TimYates earned 250 total points
ID: 12116808
>  I am able to do this with JSTL
>  <c:if test="${page.endValue != page.totalValue}">

Yeah, jstl uses expression parsing to allow you to do this...unfortunately, there is no way to do this with struts...

that looks like a good hybrid solution :-)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12502478
I think this should be a PAQ and refund...  I did nothing more than emotional support ;-)

Keep up the good work though girionis!  My inbox is a testament to the work you have done over the last day or two!!

*faint* ;-)

Tim
0
 
LVL 35

Expert Comment

by:girionis
ID: 12502624
Hello Tim, you stated that there is no way to do it with Struts and I reckon this is the solution.

> My inbox is a testament to the work you have done over the last day or two!!

Yes I know, I have done all the questions in the JSP category (not so many though), now I have plenty of time :)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12502773
>  Hello Tim, you stated that there is no way to do it with Struts and I reckon this is the solution.

:-)  Cool...  I guess we'll have to wait the 4 days, and see if padmasri99 makes a comment or not :-)

God, I tried doing the cleanup once, I managed it for a couple of weeks before the workload drove me mad...

It's a thankless task generally, so again I thank you for doing it :-)

Good luck with beating me soundly in the Java TA ;-)  *grrr* ;-)

hahaha

Tim
0
 
LVL 35

Expert Comment

by:girionis
ID: 12502844
> Good luck with beating me soundly in the Java TA ;-)

Hehe that was when I literally had no work at all :) Good you were busy back then otherwise I would still be 100,000 points behind :)
0
 

Expert Comment

by:a_bajpayee
ID: 21212602
>> Yes I tried with scrilets (value="<%= total %>")also it also ended up in error.

I would try value="<%= total.toString() %>"
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JSP Popup page 2 116
maven project in eclipse 11 59
spring AOP 6 85
iterator/ListIterator approach 17 26
When we purchase storage, we typically are advertised storage of 500GB, 1TB, 2TB and so on. However, when you actually install it into your computer, your 500GB HDD will actually show up as 465GB. Why? It has to do with the way people and computers…
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

770 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