JSTL: Work with conditional statements

Hallo everybody!
I'd have the following question:
If I need to have a condition whithin my JSP, I can write, e.g.:
<c:if test="${pageContext.request.method=='POST'}">Here I access some class variable, it is clear.
But what if a condition concerns a result of a method call on an object? E.g., I need to check if pageConfig.isReadonly("commodity_group") is true or false?
Obvously, <c:if test="${pageConfig.isReadonly("commodity_group")}"> does not work.
I can't find a way to do it...
Andrew

There isn't a direct way in EL. EL can only call getters/setters.
It can not call any bean methods that take parameters
You can hack it a little if your pageConfig bean has two attributes instead of one.
public class PageConfig{
  String field;
  public String getField(){return field;}
  public void setField(String field){this.field = field;}
  public boolean isReadOnly(){ return isReadOnly(field) }
  public boolean isReadOnly(String field){
    //your implementation
}And then
<c:set target="pageConfig" property="field" value="commodity_group"/>
<c:if test="${pageConfig.readOnly}">
</c:if>An alternative in an EL container is to use a custom function.

Similar Messages

  • Multi-page units of work with automatic state management

    Hi Jhs team:
    When my applications need to support an end-user task requiring data entry on many different web pages to complete,
    how to building multi-page units of work with automatic state management ? please give some instruction .

    Ting Rung,
    You can do this in two ways:
    - use a Struts form bean to collect all the values over the requests
    - submit the changes of each request to bc4j, but do not post and commit the changes to the database.
    The latter is easiest. For this to work, you must set the doCommit property of all your save actions in the stuts-condig to false, except for the last save action in the chain of requests.
    In addition, in your application module class, you need to overwrite method postChanges as follows:
    * DO NOT post the changes to the database
    public void postChanges() throws Exception
    // do not post here
    // posting will happen when the commitChanges
    // method on the handler is invoked
    Steven Davelaar,
    Jheadstart Team.

  • JSTL Working with collections

    Hi. I had a List in my page, and using JSTL could happily use <c:foreach /> to scan through it, and each of my objects in the List could succesfully be used for output with their setters and getters.
    Now I have a new situation where I have a Map, which contains a number of pairings of a Key to a List. Then each List contains one or more Maps. I need to use JSTL to work through the structure until I get a reference to the final Map. Can this be done?
    So I have...
    Map (key---->List)
    List--of several---Map
    I need ref to this map.
    Thanks!

    Hi,
    According to your description, you might want to gather all the SPWeb object into a collection object in order to delete all of them finally.
    As we can see, there is no such method in
    SPWebCollection object can meet you requirement, as a workaround, we can push all the SPWeb objects into an array, then operate
    these SPWeb objects in this array would do the trick.
    Here is a link about how to create a generic collection for a list of objects:
    http://www.andreasbijl.com/powershell-create-collections-of-custom-objects/
    More information about using collection in PowerShell:
    https://www.simple-talk.com/sysadmin/powershell/powershell-one-liners--collections,-hashtables,-arrays-and-strings/
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

  • Variable not working with IF Statement

    I'm having issues creating a Variable that examines a Date field called Customer Need Date in which, depending on the value of this Date I wish to either return "N/A" or the [Customer Need Date] less the Current Date (which is today's date). There are three scenario's that can appear in the [Customer Need Date], it will either be: blank (in which I want it to return "N/A"), have a value of 1/1/99 (in which I want it to return "N/A"), or have any other date (in which I want it to return the number of days between the Current Date and the Customer Need Date).
    My initial attempt at creating the variable which works fine (but doesn't remove the 1/1/99) is:
    =If(IsNull([Customer Need Date]);"N/A";DaysBetween([Current Date];[Customer Need Date]))
    But now I want to also show "N/A" if the [Customer Need Date] is equal to 1/1/99.  I've tried two different ways (below) both of which do not work.
    =If(IsNull([Customer Need Date]);"N/A";if([Customer Need Date]="1/1/99";"N/A";DaysBetween([Current Date];[Customer Need Date])))
    This gives me an error at pos 63, the '=' function uses an invalid data type.
    I also tried these (two different ways both with same error message):
    =if([Customer Need Date]InList("1/1/99";" ");"N/A";DaysBetween([Current Date];[Customer Need Date]))
    and
    =if([Customer Need Date]InList("1/1/99";" "))Then("N/A")Else(DaysBetween([Current Date];[Customer Need Date]))
    Both returned this error, The "InList" function uses an invalid data type (pos 31)
    **Please note both Customer Need Date and Current Date are Variables and have square parenthesis around them but I am unable to do so as it creates a hyperlink in this format.
    Any help to make this formula work would be greatly appreciated!!
    Thanks
    -Trevor

    you cant compare a date with a string.
    use:
    =If(IsNull(Customer Need Date);"N/A";if(Customer Need Date=ToDate("01/01/99";"MM/dd/yy");"N/A";DaysBetween(Current Date;Customer Need Date)))

  • Is there a tutorial/primer for working with conditional text and page numbering in book folders?

    I'm ramping up on FrameMaker 9 and have been experimenting with using folders in book files. I like being able to add Frame files to the folder to organize content. But I also need to use conditional tags. In one version of my book, the entire contents of some files in one folder are hidden using conditional text. I can't figure out how to set the numbering for each file so that the page numbers adjust appropriately in this scenario. Or is it even possible to do this?
    Can anyone recommend an advanced tutorial for using folders in Frame 9?

    Michelle,
    It would be easier to maintain if you create a different book file that omits the entire "conditionalized" set of files.
    See these Adobe TechComm blogs for some more background info on using hierarchical books and numbering behaviour:
    http://blogs.adobe.com/techcomm/2009/05/xml_authoring_projects_using_hierarchical_books.ht ml
    http://blogs.adobe.com/techcomm/2009/06/numbering_in_hierarchical_books.html

  • Help with conditional statements

    i am being forced to develope a game and really only know the
    basics of flash. What i need to have happen is have a movie clip
    drag something but only when the clip is in its closed position.
    Essentially it would be like having a movie clip of a hand that
    opened and closed and when the hand was closed you could press a
    button to make it drag something. Can anyone help me with the code
    i need for this.
    Any help would be appreiciated.

    You didn't say whether the hand movie clip is looping its
    action or not.
    Assuming that the clip constantly loops between an opened and
    closed hand, here is a simple script.
    First, determine which frame number is the open hand (and it
    should come AFTER the open position). In my examples, I'll assume
    that the hand closes on frame 20 inside the movie clip.
    Second, give your movie clip an instance name. In this
    example, I'll call it "hand".
    Finally, place this script in an empty keyframe on the root
    timeline, either at frame 1, or at the same frame number where the
    hand first appears:
    hand.onPress = function() {
    if (this._currentframe>=20) {
    this.stop();
    this.startDrag();
    hand.onRelease = function() {
    this.stopDrag();
    this.play();
    Hope this helps.

  • Help with dynamic statement returning values into collection

    Hi All
    I am trying to use dynamic statement to return values into a collection using the returning clause. However, I get an ORA-00933 error. Here is a simple setup:
    create table t(
        pk number,
        id_batch varchar2(30),
        date_created date,
        constraint t_pk primary key ( pk )
    create or replace type num_ntt is table of number;
    create or replace type vc2_ntt is table of varchar2(30);
    create or replace
    package pkg
    as
      type rec is record(
          pk        num_ntt,    
          id_batch  vc2_ntt
      procedure p(
          p_count in number,
          p_rt    out nocopy rec
    end pkg;
    create or replace
    package body pkg
    as
      procedure p(
          p_count in number,
          p_rt    out nocopy rec
      is
      begin
          execute immediate '
          insert into t
          select level, ''x'' || level, sysdate
          from   dual
          connect by level <= :p_count
          returning pk, id_batch into :pk, :id_batch'
          using p_count returning bulk collect into p_rt.pk, p_rt.id_batch;
      end p;
    end pkg;
    declare
      r  pkg.rec;
    begin
      pkg.p( 5, r );
    end;
    /

    sanjeevchauhan wrote:
    but I am working with dynamic statement and returning multiple fields into a collection.And using an INSERT...SELECT statement combined with a RETURNING INTO clause still does not work. Whether it's dynamic SQL or not: it doesn't work. The link describes a workaround.
    By the way, I don't see why you are using dynamic SQL here. Static SQL will do just fine. And so you can literally copy Adrian's setup.
    Regards,
    Rob.

  • Work with cumulative KF in the BEx

    Hi all,
    I have created a cumulative KF in a query. Now, I would like to work with "conditions" (or even "exceptions") on this cumulative KF.
    The problem is that "conditions" consider the actual ("internal") value of my KF and not the cumulative ("displayed") one...
    Does somebody know how to resolve this issue?
    Regards

    I have created a CKF based on the Cumulated one. The showed results for this CKF are the non-cumulated values.
    So I'm still not able to make any condition or exception on the "cumulated" value.
    Maybe there is something I did wrong...?

  • Condition for Top 10 no longer working with 2 Characteristics

    Hi experts, we have a query within a workbook with a condition set on 2 characteristics to show the top ten.  When we refresh this now it shows incorrect results as it unticks one of the characteristics in the condition.  We then have to go back to the condition set up and tick the one it unticked and it refreshes okay.  We don't want to have to do this each time.  (This worked for us prior to applying patches.  We are on Patch 18, Bex Analyzer BI Add-On 7.X based on 7.10, Support package 7, patch 1 version 1352.)
    We can't find any SAP Note to correct this?
    Any help you can offer would be great.
    Thanks.
    N

    Hi,
    I too have faced problem with conditions.As a thumb rule if i apply(assaign) the condition for the last characteristics in the tab rows (or last charactristic added in rows) giving fine results.
    Try to apply and check it may work....
    Regards,
    anil

  • HT1688 My iphone 5 won't charge and it's in perfect condition, I dont drop it and it's not cracked. I tried multiple chargers, none of them are damaged and my outlets work with other things so the problem is my phone. What's wrong with it and what should

    My iphone 5 won't charge and it's in perfect condition, I dont drop it and it's not cracked. I tried multiple chargers, none of them are damaged and my outlets work with other things so the problem is my phone. What's wrong with it and what should I do? Please help me I need my phone for work.

    Make sure there's nothing blocking a contact in the charging port of the phone.

  • Conditional formatting doesn't work with scatter chart

    Hi,
    I am working on OBIEE 11g(11.1.1.7.0) and trying to create scatter chart with conditional formatting. But this is giving issue and conditions are not getting applied.
    suppose I have take columns "product numer","product","office","product type","Revenue" & "Actual unit price"
    I created the scatter chart using above columns and applied below conditions.
    if revenue is equal to/ is in 1080 then color is yellow
    if revenue is less than 1080 then color is blue
    if revenue is greater than 1080 then color is red.
    After applying all the condition, 1st condition is not getting applied. All the charts are showing blue and red color only.
    Anyone have any idea about this issue?
    Thanks
    Krishna

    looks like it is bug in 11.1.1.6.2 which is not fixed in 11.1.1.7.0
    Bug 14286482
    I tried it locally with 11.1.1.7.0 on dimension column the condition filter is applying but not on measures !
    thanks,
    Saichand

  • Smart scan not working with Insert Select statements

    We have observed that smart scan is not working with insert select statements but works when select statements are execute alone.
    Can you please help us to explain this behavior?

    There is a specific exadata forum - you would do better to post the question there: Exadata
    I can't give you a definitive answer, but it's possible that this is simply a known limitation similar to the way that "Create table as select" won't run the select statement the same way as the basic select if it involves a distributed query.
    Regards
    Jonathan Lewis

  • Issue working with states (FW CS5)

    Hi all,
    Here's my thing: when I save a file and open it up again some time later, all the pages will be set in in the first state (which is shown at the top of the states panel). That's very inconvenient for me. I'd like the page to stay in the state in which I put it. Is there a solution or a workaround?
    Another thing what's happening when I open up a saved document, is that some objects don't show themselves when I activate a different state of the page where the object is placed upon. It's showing up only after double clicking the object (and open up the object view, the page is grayed out) and the return to the page view. Pretty unhandy.
    Also when saving: FW will always show the first page in the document, not the last page I've worked on. I'd like it to see that specific page.
    Any help would be appreciated very much.

    Hi Linda,
    thanks for your reply, but it doesn't solve my problem. I'm not putting pages on states. I do add states to pages. My main issue now is this:
    What's happening when I open up a saved document, is that  some objects don't show themselves when I activate a different state of  the page where the object is placed upon. It's showing up only after  double clicking the object (and open up the object view, the page is  grayed out) and the return to the page view.
    It's very important for me to resolve this, since other people working with my file otherwise only see white space instead of objects.
    Thanks for your help.
    Robbert

  • JSTL comparision doesn't work with jdeveloper 10.1.2.2.0

    Hi,
    can somebody explain me why comparision are not working with JSTL. I quess reason is the type of the variables, but how can I solve it?
    Is the anyway to cast to same object-type?
    I try also compare directly with bindings, but didn't work either. That why I use temporary page scope variables.
    <c:set var="comp2" value="${bindings.Organisation}" scope="page" />
    <!-- prints "-203-", which is correct -->
    <tr><td> </td><td>
    -<c:out value="${comp2}"/>-
    </td></tr>
    <!-- loop over possible values -->     
    <c:forEach var="RowTL" items="${bindings.OrganisationCode.rangeSet}" >
    <c:set var="comp1" value="${RowTL.KarvTunnusnumero}" scope="page" />
         <!-- print "-203-11" when reach correct item which should match -->
    <tr><td> </td><td>
    -<c:out value="${comp1}"/>-<c:out value="${RowTL.KarvKoodiarvo}"/>
         <!---- true always with fixed value - not reasonable -->
    <c:if test="${comp2 == '203' }">
    <c:out value="11111111"/>
    </c:if>
         <!---- true with correct item, with fixed value - not reasonable -->
    <c:if test="${comp1 == '203' }">
    <c:out value="22222222"/>
    </c:if>
         <!---- false always althouhg printed values with correct item are "203" = "203" -->
    <c:if test="${comp1 == comp2 }">
    <c:out value="33333333"/>
    </c:if>
         <!---- false always althouhg printed values with correct item are "203" = "203" -->
    <c:if test="${comp2 == comp1 }">
    <c:out value="4444444"/>
    </c:if>
    </td></tr>
    </c:forEach>
    thanks PLa

    Works fine, thanks,
    Now it is comparing wtih string values I guess.
    Do you know any good source where can I read about those object types of bindings? I tried also debugger to investicate the structure of object, but debugger didn't show anything.

  • Ear Sir: Yesterday on 18.09.2014 evening, I wanted to install IOS 8.0 according to your instructions iPhone 5S.during installation Stopped working and was closd, I can not work with him. Ibought it in the United States Apple Store Fifth 40venue 767 N

    Dear Sir: Yesterday on 18.09.2014 evening, I wanted to install
    IOS 8.0 according to your instructions iPhone 5S.during installation
    Stopped working and was closd, I can not work with him. Ibought it in
    the United States
    Apple Store Fifth 40venue 767 New York NY1053
    iPhone 5s Spase Gray 32 gb verizon.
    Part Number: ME344ll / A.
    Serial number: DN*******NjM.
    Model A1533. I would like to request a new password for opening the
    iPhone.  Passwod..... Thank you very much,
    Im not difficult for you to request a quick answer.Israel.
    <Personal Information Edited By Host>

    We are fellow users here on these forums, you're not talking to iTunes Support nor Apple - it looks like somebody has asked the hosts to remove your personal info from your post (it's not a good idea to post any personal info on any public forum).
    What do you 'stopped working and was closed, I can not work with him' ? What exactly are you seeing on the phone's screen ?
    If it's the activation screen and you can't remember your password for your account then see if you can get it reset via http://iforgot.apple.com

Maybe you are looking for

  • Windows folder shows when networking, but not contents.

    Greetings, I am using my MacBook Pro (client) to network wirelessly with my PC (server) using Windows file sharing (XP). I have three folders that I share. All three show up, but only two of them show their contents. I have checked and rechecked my s

  • Need help with generics

    I have written a java program using jdk1.5. After completing my program I noticed that the compiler was outputting a warning. It tells me that there were a few unsafe operations in my code. Anyway I found out that my code needed to include generics.

  • Printing 3026 copies of a 2 pages document in Indesign CS4

    Hi, I have a problem in InDesign CS4. I have a 2 pages document, that I want to print 3026 copies of. I know, that ID only will let me print 999 copies, but I only get a pdf-file of the 2 pages (page 1 and page 2), not 999 copies of the document. How

  • Fox-function: MAX/MIN

    Hi, I have a question on MAX/MIN-function. It is possible to find the maximum date in a column ( 0calmonth). And other problem that I don't know the syntax of the max-function. The SAP-help isn't significant. Thanks. Holger

  • Cannot Custom Codec on RedHat ES3 Update 3

    I want to custom my Codec Chain in a test program with the following line of code <Processor >pro1.setContentDescriptor(new ContentDescriptor(ContentDescriptor.RAW)); TrackControl[] controls=pro1.getTrackControls(); controls[1].setCodecChain(new Code