Is there a logic:match equivalent for JSTL?

In a search page I execute a query which returns an array of objects (All objects are of the same object type and are cast to Object[]) and each object has many attributes. I tried using <logic:iterate>, but I was never successful in having it display any results. I believe this had something to do with the entire array being passed via session scope instead of just one record and me not specifying it properly with <logic:iterate>. I was able to successfully use <c:forEach> and it worked right away. I stuck with using that because of its "just works" ability in addition to using a lot of other JSTL code. However, one of the attributes that is being printed out needs to be parsed and is of the form "Yxxx". <logic:match> covers this very nicely, but when I specify it in the below code it is not able to find my variable in any scope.
<c:forEach var="myResults" items="${sessionScope.result}" varStatus="status">
    <logic:match parameter='${myResults}' property='pin' value='Y'>
        <c:out value="Preeti"/>
    </logic:match>
</c:forEach>I have done several google searches, but I haven't found a JSTL equivalent for <logic:match>. If there is one could someone please tell me what it is? In addition, although <logic:match> is great I still need to print out a substring of that attribute. Could someone tell me how to do that? If this is not possible could someone please tell me if its possible to use <logic:iterate> with an array of objects like I was attempting to do initially so that I could use <logic:match> at least?
Thanks to all of you for your time.

Yes you can use the logic:iterate tag. I think you have to specify the type of the exposed variable though. I prefer the forEach loop.
I think you are using the wrong attribute in the logic:match tag. You should be using the "name" attribute rather than "parameter"
Parameter attribute refers you to a request parameter, and I pretty sure you don't want that.
So given the collection of objects in the session attribute "result"
This should loop through them all, and see if they start with the letter 'Y'
<c:forEach var="myResults" items="${sessionScope.result}" varStatus="status">
    <logic:match name='myResults' property='pin' value='Y'>
        <c:out value="Preeti"/>
    </logic:match>
</c:forEach>As for the latter bit, are you using a JSP2 container and JSTL1.1? It would appear so seeing as you are trying to use EL expressions in the logic:match tag.
If so, you could make use of the JSTL function library:
<c:forEach var="myResults" items="${sessionScope.result}" varStatus="status">
   <c:if test='${fn:startsWith(myResults.pin, "Y")}'>
      <c:out value="${fn:substring(myResults.pin, 1, -1)}"/>
    </c:if>
</c:forEach>And I've just spotted a very cool function in there: substringAfter
<c:forEach var="myResults" items="${sessionScope.result}" varStatus="status">
      <c:out value='${fn:substringAfter(myResults.pin, 'Y')}'/>
</c:forEach>Cheers,
evnafets

Similar Messages

  • Why is there no Capture Pilot equivalent for Lightroom?

    Why is there no Capture Pilot equivalent for Lightroom?

    Nothing like it that I know of
    But I just +1 the idea here: Capture Pilot equivalent for LightRoom? on Adobes feedback site & suggest you do too!

  • Is there an MS Visio equivalent for Snow Leopard

    Is there an MS Visio equivalent for Snow Leopard which can read Visio files (*.vsd), save as Visio files, and paste drawings etc into Microsoft Office applications (Word, PowerPoint, etc)

    Since Ovation take PP slides have you tried just exporting Keynote to PP? Does that work for you?
    Haven't used Ovation myself - looked at the demos and was distinctly underwhelmed, but then I've always thought KN did what I wanted - interesting that Ovation claims to improve type legibility - with KN that comes as standard! Would love a clock timer on screen though.....

  • Is there an Adobe Ovation equivalent for Keynote

    Hi there Keynote users,
    Anyone know of an Adobe Ovation equivalent for Keynote? We are trying to use Keynote to drive multiple Plasma/LCD displays and need an app for the transition effects capabilities that Ovation offers to PowerPoint but in Keynote.

    Since Ovation take PP slides have you tried just exporting Keynote to PP? Does that work for you?
    Haven't used Ovation myself - looked at the demos and was distinctly underwhelmed, but then I've always thought KN did what I wanted - interesting that Ovation claims to improve type legibility - with KN that comes as standard! Would love a clock timer on screen though.....

  • UIX JSP equivalent for JSTL 'set'?

    Is there a UIX JSP tag that performs an analogous function to the JSTL tag 'set'? I would like to be able to setup local variables so that I don't have to repeat extended expressions.

    You can (generally) speaking use JSTL's set in UIX JSP pages, and (mostly) use JSTL JSP tags with UIX JSP tags.
    So, you should just be able to use <c:set>.
    The major complexity in integrating the two is remembering that JSTL sets and iterates immediately, but UIX JSP evaluates EL expressions only once the last UIX JSP tag completes. This doesn't cause much of a problem with <c:set> or <c:if>, but does cause some major problems with <c:forEach>.
    (A very similar problem is encountered when using JSTL tags with Java Server Faces JSP tags, so this is just a painful fact-of-life.)

  • Is there an Exchange server equivalent for Apple Xserve?

    I have an Apple Xserve and I'd like to run something like an Exchange server, to allow my Entourage clients to host calendar, email, Tasks, and addressbooks on there. Is Apple working on anything like this?
    Mike

    Hi
    There should be no need to post in the XServe Forum. The XServe is dedicated server hardware, your question is really about the Server OS. You could browse the Server Forum for more information:
    http://discussions.apple.com/category.jspa?categoryID=96
    To answer your question - Yes, absolutely. Kerio Mail Server:
    http://www.kerio.co.uk/kms_home.html
    Zimbra:
    http://www.zimbra.com/products/
    Both of these products offer support for iPhone, Treo and Blackberry. KMS has a handy facility where it can remotely 'wipe' a supported mobile device if its been stolen. Although this is speculation and not really 'allowed' on these forums I think Apple is working towards similar features in their forthcoming Server products. Right now Apple's built in mail server is poor in terms of what is offered using the Interface. It's good enough to get you going if all you want are simple Mail Services. It's actually quite good. However if you want more then you there is not much you can't achieve if you're prepared to use the command line. A necessity at some stage if you are contemplating administering a server regardless of its role. Apple are planning to expand what is available by adding 'out of office' and server side 'email rules' facilities in Snow Leopard:
    http://www.apple.com/server/macosx/snowleopard/
    You don't have that currently unless you are prepared to install avelsieve:
    http://email.uoa.gr/avelsieve/
    I'm not sure how well Apple's built-in Mail Server supports shared contacts and calendars with Microsoft's products? It's been some time but I have had some mixed success in the past. KMS has no problem regardless of platform or what is being used. For PCs it behaves exactly as if it was an Exchange Server.
    Tony

  • HDD Health: How to check it? HD Tune Pro equivalent for Mac?

    hi all, i was just wondering if there's a Mac equivalent for HD Tune Pro. it's a Windows app i use to check for errors on hard drives. i want to check if an externall 1TB HDD has any bad sectors on it before i use time machine to backup my work. i want something that'll check for any small error -- i don't want something that'll just do a basic scan.
    thank you         

    ThunderCon wrote:
    but there's software that can do it on Windows so there must be something on the Mac.
    DiskUtility, DiskWarrior, TechTools, Genius, etc. etc. just do a google search. Most are paid apps except DiskUtility which is already built in and can be accessed from your reinstall partition. I personally don't bother with any except DiskUtility, but do keep a copy of DiskWarrior on hand just in case.
    Developers will convince you that you need all sorts of programs to check and repair most often manufactured disc ailments, but if you are one of those happy to pay, then that is your choice.
    Good Luck
    Pete

  • WhatsApp equivalent for the iPad

    Hi - is there a really good equivalent for WhatsApp for the iPad?
    Thanks....

    how 'bout this one: http://itunes.apple.com/us/app/ping-for-ipad/id364737009?mt=8 ?
    JGG

  • TS4088 why is there a limit on 3 years? it should be all the MacBook Pro mid 2010 with symptoms, there should get their logic board changed for free, mine mac is 3 month late and i had this problem for over a year, but i first saw this article today :(

    it should be all the MacBook Pro mid 2010 with symptoms, there should get their logic board changed for free, mine mac is 3 month late and i had this problem for over a year, but i first saw this article today

    Hey Clintonfrombirmingham
    I called Apple technical support in Denmark, but with no positive reply.
    She couldn't do anything, and said that They had sent a recall Email about the problem and with their offer to repair the Macbook Pro, but I'd never recieved an Email about the problem. She wasn't in power to make an exception. It can't be true that i paid a lot of money, for a product that can't barely stand on its own feets, Apple didn't tell me that the product I was about to buy, would restart every 5 minute. and now when  they know the problem, they wont repair it? it just don't make sense for me. If a car seller discovers that all the brakes in a car he had sold, will crash after some years he will call all the cars back to repair no mater what. i just don't understand how Apple will make good service for their custumers, by extending the warranty from 2 to 3 years, but wont take the computers there is a little bit to old, 4 months will make the difference. i can't believe it.
    What can i do now? 
    best regards Oskar

  • Is there a Blackberry Desktop Software for MAC OS 10.4.11? Or something equivalent? Help Please!

    Hello All,
    Is there a Blackberry Desktop Software for MAC OS 10.4.11?  Or something equivalent?
    I recently switched from a palm treo to blackberry but didn't anticipate syncing issues with my mac until now.  The current BB desktop software seems only compatible with MAC OS 10.5, so I'm in a difficult position.
    Please any suggestions are deeply welcomed!!
    Thank you.
    Hillman

    No, sorry, there is not.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Creating a template in Pages is straight-forward as answered here previously. Is there and equivalent for iBooks Author which can start with a blank page and build up the template as required? or can one only adapt a ready made template?

    Creating a template in Pages is straight-forward as answered here previously. Is there an equivalent for iBooks Author which can start with a blank page and build up the template as required? or can one only adapt a ready made template? This has proved unsatisfactory to me so far. Lines are left in etc.

    There are two basic menus for fonts - one from the main menu bar and one from the toolbar. You can also bring up the font manage dialog.
    I don't recommend trying to hard to force an otherwise foreign font, as it inevitably needs to be usable/supported on iOS as well, and that can get tricky w/3rd party fonts, as an example, even with the expanded font support in the latest iBA.
    If you need to discuss fonts more, I suggest starting a new thread....preferably with a slightly more brief title, thanks.

  • HT4967 Mobile Me was so handy. I pushed the little sync button and everything updated. Is there any equivalent for I Cloud?

    Mobile Me was so handy. I pushed the little sync button and everything updated. Is there any equivalent for I Cloud?

    Welcome to the Apple Community.
    Unfortunately, iCloud does not offer equivalents to Mobile Me’s iDisk, Gallery or Web Hosting services. You will need to find a third party solution to replace these services. You might consider DropBox, SugarSync, MediaFire or any other service that offers online storage. (not all these alternatives offer all the services previously provided by iDisk)

  • Logic 10.1 for a specific project; there is no mixer and the display is completely erratic.

    Logic 10.1 for a specific project; there is no mixer and the display is completely erratic.  For other projects it's working for now.  Please help

    Try this Safari5.1 from the installer package
    http://www.filefactory.com/file/cc9005d/n/Safari.pkg.zip
    The download worked better with Firefox not sure why. At the bottom of the page after the captcha>> slow down load is the Free link,  it took about 4 minutes to download on my test.

  • Is there an "adobe flash player"  equivalent for ipad2

    is there an "adobe flash player" equivalent for iPad 2

    JuneSlutsky wrote:
    is there an "adobe flash player" equivalent for iPad 2
    Your best course of action is to email the web sites that use Flash and request that they support iOS. If you also mention that there are now well over 200 million iOS users worldwide that can't use the web site it might get their attention. A colleague of mine has been bent out of shape over the Flash issue since day one but he has finally started to contact web sites and request they support iOS. He has gotten several "we're working on it" responses so far. If all iOS users started doing this it would wouldn't be long before the issue would disappear. Strength in numbers and all that.

  • Is there an itunes gift card for itunes match service?

    is there an itunes gift card for itunes match service? if yes does it needs a us credit card to activate it?

    Try these locations,
    https://locate.apple.com/sa/en/sales/?a=Taif+city+saudi+arabia&pt=all&x=3&y=9

Maybe you are looking for

  • How to develope application with multiple schema

    Hi, In my application, there is 3 schema, forms are from different schema, but the database is one. How should I manage it, When i open the form with different schema I am not getting the expected result, I am using Oracle 10g Forms & Database Thanks

  • Java Plug-in problems following installation of Oracle 9i

    I have been experiencing repeatable problems with the Sun Java Plug-in following installation of Oracle 9i on our servers. Our installation of the Sun JDK 1.3.1_04 or higher seems to conflict with the Oracle installation. Following the install, navig

  • GIF images in JFrame

    hi all, i'm trying to put a gif image in JFrame. The problem is the gif images gets flickering(fluctuation) while it is placed in a frame. i had also placed some labels near the image and all of them gets disturbed becoz of this gif file in frame. pl

  • How to restore a fcp project to the earlier time

    hi iam venkat from hyderabad.. i completed the full editing work of an event and then i wanted to add titles in the starting. So i selected the timeline and draged to make free space in the starting, i tried for 2 3 times but it didnt moved. what mad

  • Mutiple file sender to mutilple file response

    Hi I have a scenario where i am receiving the multiple files from source at  same time...XI has to pick up all files at single ( I think we can do that using the File masking ) but the problem is i want the response back to each sender file...how we