EL - How do you call a method that requires a parameter

How do you call a method that requires a parameter
In scriplet code here is what I am trying to do
<%= car.getDefaultColor(car.getCarType()) %>
How do I do this in EL
Here is my guess (it generates the Exception described below)
${car.defaultColor(car.carType)}
Here is the Exception I am getting:
javax.servlet.ServletException: <h3>Validation error messages from tag library c</h3>tag = 'out' / attribute = 'value': An error occurred while parsing custom action attribute "value" with value "${car.defaultColor(car.carType)}": Encountered "(", expected one of ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and", "&&", "or", "||"]
Any Ideas?
P.S. If it matters to you, I am using JSTL 1.0 and the code snippets above are actually within the value attribute of a <c:out value="" /> statement.

How do you call a method that requires a parameter
In scriplet code here is what I am trying to do
<%= car.getDefaultColor(car.getCarType()) %>
How do I do this in ELYou don't. EL is very strict in method signatures. All get methods must be public Type getProperty(void); And all set methods must be public void setProperty(Type t);
So you will have to re-work your Bean so it does not need an argument to the get method (getDefaultColor()). Since you are calling another method out of car, you might re-write the getDefaultColor method as such:
  public Object getDefaultColor() {
    CarType ct = this.getCarType();
    //then do other stuff
  }If that isn't suitable, then provide a helper method that is used to set the current car type and then call the getDefaultColor:
  private CarType curCarType;
  public void setCurrentCarType(CarType ct) { curCarType = ct; }
  public Object getDefaultColor() {
    if (curCarType == null) throw new IllegalStateException("CarType must be set before getting color");
    //normal work using curCarType
<c:set target="${car}" property="currentCarType" value="${car.carType}"/>
<c:out value="${car.defaultColor}"/>It is better to do as little of the data manipulation (setting up the car type) in the JSP as possible, so the first option is better than the second. Also better then the second would be to set the current car type in a servlet or data access object (or wherever) from which your retreive the car to begin with. Manipulatig it in the JSP itself should be your last resort (to keep as much business logic out of the JSP as possible).
Here is my guess (it generates the Exception
described below)
${car.defaultColor(car.carType)}
Here is the Exception I am getting:
javax.servlet.ServletException: <h3>Validation error
messages from tag library c</h3>tag = 'out' /
attribute = 'value': An error occurred while parsing
custom action attribute "value" with value
"${car.defaultColor(car.carType)}": Encountered "(",
expected one of ["}", ".", ">", "gt", "<", "lt",
"==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[",
"+", "-", "*", "/", "div", "%", "mod", "and", "&&",
"or", "||"]
Any Ideas?
P.S. If it matters to you, I am using JSTL 1.0 and
the code snippets above are actually within the value
attribute of a <c:out value="" /> statement.

Similar Messages

  • How do you call a method from  another class without extending as a parent?

    How do you call a method from another class without extending it as a parent? Is this possible?

    Why don't you just create an instance of the class?
    Car c = new Car();
    c.drive("fast");The drive method is in the car class, but as long as the method is public, you can use it anywhere.
    Is that what you were asking or am I totally misunderstanding your question?
    Jen

  • How do you call a function that belongs in a package?

    Hello,
    Can anyone help me with this issue? My intent is to create a procedure that returns a cursor to the results of the query without passing in the cursor to the function. After reading thru online tutorials, I found that I had to create a function, not a procedure.
    I created a .sql file as such:
    create or replace package GetEmployeeCursors is
    type empResultSet is REF CURSOR;
    function Funct1 return empResultSet;
    end GetEmployeeCursors;
    create or replace package body GetEmployeeCursors is function Funct1 return
    empResultSet is
    tmpResultSet empResultSet;
    begin
    open tmpResultSet for
    select * from employee;
    return tmpResultSet;
    end Funct1;
    end GetEmployeeCursors;
    Both the package and package body were created without any problems.
    Then, I tried to call the Funct1() in many ways, including the following:
    call System.getEmployeeCursors.Funct1()
    call getEmployeeCursors.Funct1()
    call Funct1()
    All produced the following error message:
    ERROR at line 1:
    ORA-06576: not a valid function or procedure name
    How do I call Funct1()?
    Thanks so much in advance,
    --Anna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hello Frank,
    Thanks for the information regarding not using the system schema when creating packages.
    I tried what you suggested to call the Funct1 in many ways:
    SQL> mycursor := system.getEmployeeCursors.funct1;
    SP2-0734: unknown command beginning "mycursor :..." - rest of line ignored.
    SQL> mycursor := getEmployeeCursors.funct1;
    SP2-0734: unknown command beginning "mycursor :..." - rest of line ignored.
    SQL> mycursor := funct1;
    SP2-0734: unknown command beginning "mycursor :..." - rest of line ignored.
    SQL> select *
    2 from table(system.getEmployeeCursors.funct1);
    from table(system.getEmployeeCursors.funct1)
    ERROR at line 2:
    ORA-22905: cannot access rows from a non-nested table item
    Could there be something else I need to do before making the function call?
    Thanks alot!
    --Anna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How do you view web content that requires a Flash plug in?

    The iPad is my first Apple product.  There seem to be restrictions that limit access to various of my favorite web sites.  Work arounds or other options?

    Julian Wright wrote:
    The Flash plugin version 11 will be available for all current Android and other devices forever.
    Wrong! There are plenty of "current Android" devices that cannot run Flash because they don't run and will never run Android 2.2 or above. Likewise there are plenty of "other devices" that can't run Flash too.
    I'm not concerned about devices which don't run Flash. The point is that there is Flash content on the web, and there are mobile devices that support it. You may not care, but obviously judging by many posts, some people do.
    And companies like RIM are making sure that their devices will continue to support it, I'm sure Android will be right there with them.
    Although you are correct that Adobe said nothing about deprecating it on the desktop (quite the opposite in fact), if companies are investing in HTML5 sites for the growing number of mobile users, they're not going to bother creating a Flash version for desktop users, when those desktop users can view exactly the same HTML5 site. Why make two sites when one will work on everything.
    Because HTML5 can not do everything Flash can, therefore there will still be content created in Flash. Like Games, and high end video sites. What is more likely to end is mobile website development, and instead the region will be dominated by apps, with desktop web browsing still offering the best experiences coupled with plugins like Flash.
    Flash will never rule the desktop. Proprietary technologies are dying. Standards are becoming the norm. (BTW native applications for different OSs are not the same as proprietary technologies).
    You say "never" yet right now as you say it, the desktop is ruled by Flash and other plugins, and has been since day 1 of it's creation. Flash is what created youtube, facebook games. Plugins created sites like netflix and games like runescape. How you can say never, while standing in it is insane.
    Bottom line, the desktop is going to be even more media rich due to Flash 11 and stage3d and hardware acceleration. And yes, many mobile devices won't be able to run that content and will have to use apps, but for those that want them, the devices will exist and so will the content.
    The iPhone has been out nearly 6 years now... never supported Flash, and yet here we are, people still flooding the forums daily asking for it. How many more years and devices will you go through before you're HTML web finally emerges? 6 more?

  • How do you watch movies online that require adobe flash?

    I would like to know what application to use to watch movies online on Hulu or Xfinity. Both require flash but I read that Flash doesn't play well with Mac. Thanks!

    If you had said what Mac you have and what version of OS X I could be more specific, so:
    You can check here what version of Flash player you actually have installed:  http://kb2.adobe.com/cps/155/tn_15507.html
    You can check here:  http://www.adobe.com/products/flash/about/  to see which version you should install for your Mac and OS. Note that version 10,1,102,64 is the last version available to PPC Mac users*. The latest version,10.3.183.23 or later, is for Intel Macs only running Tiger or Leopard, as Adobe no longer support the PPC platform. Version 11.4.402.265 or later is for Snow Leopard onwards.
    * Unhelpfully, if you want the last version for PPC (G4 or G5) Macs, you need to go here:  http://kb2.adobe.com/cps/142/tn_14266.html  and scroll down to 'Archived Versions/Older Archives'. Flash Player 10.1.102.64 is the one you download. More information here:  http://kb2.adobe.com/cps/838/cpsid_83808.html
    You should first uninstall any previous version of Flash Player, using the uninstaller from here (make sure you use the correct one!):
    http://kb2.adobe.com/cps/909/cpsid_90906.html
    and also that you follow the instructions closely, such as closing ALL applications first before installing. You must also carry out a permission repair after installing anything from Adobe.
    (If you are running a PPC Mac with Flash Player 10.1.102.64 and are having problems with watching videos on FaceBook or other sites, try the following solution which fools the site into thinking that you are running the version 11.5.502.55:)
    Download this http://scriptogr.am/nordkril/post/adobe-flash-11.5-for-powerpc to your desktop, unzip it, and replace the current Flash Player plug-in which is in your main/Library/Internet Plug-Ins folder, (not the user Library). Save the old one just in case this one doesn't work.

  • How do you call a java class from the main method in another class?

    Hi all,
    How do you call a java class from the main() method in another class? Assuming the two class are in the same package.
    Thanks
    SI
    Edited by: okun on May 16, 2010 8:40 PM
    Edited by: okun on May 16, 2010 8:41 PM
    Edited by: okun on May 16, 2010 8:47 PM

    georgemc wrote:
    To answer your impending question, either the method you're calling has to be static, or you need an instance of that other class to invoke it against. Prefer the latterAnd to your impending question after that: no, don't use the Singleton pattern.

  • How do you call a field?

    Good morning everyone,
    I'm trying to work with the BufferedInputStream (work from friday) and i went to the website:
    http://java.sun.com/j2se/1.4.2/docs/api/java/io/BufferedInputStream.html#BufferedInputStream(java.io.InputStream)
    at that website they have a "field summary" and i want to use the buf array (cause it says thats where the data is stored) but i cant figure out the coding to put it in my project. how do you call a field?

    Fr. Murderess,
    a) The short answer is "no". Only public methods and fields can be accessed that way.
    b) If getting the "buf" field is of paramount importance to you, declare a class like this:
    public class MyBufferedInputStream extends BufferedInputStream {
        public MyBufferedInputStream(InputStream in) { super(in); }
        public MyBufferedInputStream(InputStream in, int size) { super(in, size); }
        public byte[] getBuf() { return buf; }
        public void setBuf(byte[] newBuf) { buf = newBuf; }
    }to get and set the "buf" field. As you can see by reading the source code of BufferedInputStream, the other fields (count, pos and markpos) are needed too, and you will need to provide the getters and setters for the other fields.
    It's better not to "fiddle" with the protected fields of BufferedInputStream. Simply use BufferedInputStream "as is", and don't bother about the "buf" field.
    I think that you will need to tinker only with the size of the buffer (maybe to cache more data inside), but it is available in the second constructor of BufferedInputStream (InputStream in, int size).

  • How can we call the method of used controller?

    Hi All,
       i created two WDA Applications.( like YWDA1,YWDA2 ) . i am using the component WDA2 in WDA 1.and displaying the one view of WDA2 as popup window in WDA1 on action of one of the input element in the view of WDA1 by using the method l_window_manager->create_window_for_cmp_usage
    I have a button on the view of WDA2 which has appear in the popup window...how can i call the method which has binded to that button....and where should i code that...and i need to assign selected value in the popup window to input elemetn of view  WDA1
    Please help me to resolve this....
    Regards,
    Ravi

    You can not directly call view's event handler from other component.
    create a method in component controller of the second component and in the button click call the component controller method. ( also make the method as interface so that you can call it from other components )
    Now, you can call the interfacecontroller's method
    DATA: l_ref_INTERFACECONTROLLER TYPE REF TO ZIWCI__VSTX_REBATE_REQ_WD .
      l_ref_INTERFACECONTROLLER =   wd_This->wd_CpIfc_<comp usage name>( ).
      l_ref_INTERFACECONTROLLER->Save_Rr(
        STATUS = '01'                       " Zvstxrrstatus
    save_rr is the method of second component controller

  • How would I call a method inside a dll?

    How would I call a method inside a dll? Is it even possible in Java? Like in VB you would do something like this: XXX.dll --> XXX.Activate()... I have already loaded the dll like this:
    String xxx = "C:/WINDOWS/system32/xxx.dll";
    System.load(xxx);
    Please help?
    THX

    I've got another question.
    I've gone through the link you posted and a couple others that I found.
    I am able to create an interface using the windows kernel32.dll and go through an example I found.
    But when I try to use a dll that I have from another application, I have problems.
    Here is what I have for the interface.
    public interface IAiCamDeviceControl extends StdCallLibrary {
         public IAiCamDeviceControl INSTANCE=(IAiCamDeviceControl)Native.loadLibrary("D:\\IAiCamDeviceControl.dll",IAiCamDeviceControl.class);   
    //        public long GetVersion( String s );
    //        public long Close();
    }The interface that works looks like this:
    public interface Kernel32 extends StdCallLibrary {
         public Kernel32 INSTANCE=(Kernel32)Native.loadLibrary("Kernel32",Kernel32.class);I thought that the problem might be using the path name for the library, so I copied it into the system32 directory.
    Still get the same error:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'D:\IAiCamDeviceControl.dll': The specified module could not be found.
    My main looks like
    public class Main {
        public static void main(String[] args) {
    //          Kernel32 lib=Kernel32.INSTANCE;
    //          Kernel32.SYSTEM_POWER_STATUS batteryStatus=new Kernel32.SYSTEM_POWER_STATUS();
    //          lib.GetSystemPowerStatus(batteryStatus);
    //          System.out.println(batteryStatus);
                IAiCamDeviceControl camDev = IAiCamDeviceControl.INSTANCE;
    }The commented part is from the version that worked.
    All I attempted to do here was just create an instance of the interface.
    Any idea why I can't access the dll?
    The dll is the same one that is used successfully in VB, C#, and C++ demo programs, so I suspect it is a good dll.

  • How do you call 0900 numbers on iphone?

    how do you call 0900 numbers on iphone? it keeps saying that i cant call it- is there a code or anything?
    im on vodafone
    thanks

    thanks for the advice both
    ive noticed though that sometimes companies provide a cheaper alternative to an 0900 number as in 8***** or something - if this makes any sense? but even those numbers are still blocked???

  • How do you use an app that you downloaded on your computer?

    How do you use an app that you down loaded on your computer. I am having trouble because I can download the app just fin but when I actually want to use that app I have no idea what to do. I tried to look for any open buttons but there are none. I downloaded the app on my phone origionaly and I then I downloaded it on my laptop. the app is called arkvpn.

    The apps for the iPhone will not run on Mac

  • Dont ask why! How do I call an applet that is in a jar file that is...

    Can someone tell me how I would call an applet that is inside of a jar file that is inside of a parent jar file?
    example call to an Applet
    <APPLET CODE="TimeApplet" ARCHIVE="time.jar" />what I want to do is something like
    <APPLET CODE="TimeApplet" ARCHIVE="parent.time.jar" />
    where parent is the top jar and time is the inner jar.any help or links to tutorials/articles would be most appreciated.
    if you ask why I wont answer.

    we are doing a signed applet and we only want the user to have to sign 1 time
    and we have lots of applets to display so we dont want to have them sign for
    each item.Sorry but that doesn't make much sense, niether does putting a jar file in a jar file.
    Do you want the "do you trust" question only one time? If so than you only have
    to sign all the jar files with the same key.
    You can load a jar file from your applet but it seems that these jar files will run
    in sanbox security no matter how you sign it:
    http://forum.java.sun.com/thread.jspa?messageID=3582952
    Asking why does make sense, I coud be asking how to climb a building without
    telling my objective is to get on the 10th floor.
    You would tell me how to climb the building an I'd probably do it and find out
    later I could just as well have taken the elivator.

  • How i can call an item that the name of the bloc is a param --URGENT--

    how i can call an item that the name of the bloc is a param
    exp:
    DECLARE
    B VARCHAR2(20);
    begin
    B:='BLOC1';
    :B.Text1:='Hello'; --- a want this

    Looks like your talking 'bout Forms, don't you?
    What you're looking for is the copy built-in, syntax is e.g.
    COPY ('MY TEXT', 'EMP.ENAME');

  • No longer use this email account but how do you backup the email that is...

    No longer use this email account but how do you backup the email that is in the "example" folder, So that I can delete the account on my mail app?

    Not sure what you mean. Deleting a POP account only deletes the messages stored in the account’s mailboxes, not any messages stored in custom “On My Mac” mailboxes, if that’s what you mean. It’s not that Mail goes after your mail trying to delete as much as it can. It’s just that if a mail account is deleted, then its mailboxes cannot exist anymore...
    That said, instead of deleting the account right away, you can just disable it (i.e. turn OFF Preferences > Accounts > Advanced > Enable this account), leave it that way for some time, and delete it only after making sure you didn’t miss anything while the account was disabled.
    BTW, if you back up your data, and the ~/Library/Mail folder in particular, you won’t have to worry about accidentally losing anything as a result of doing something like that...
    Note: For those not familiarized with the ~/ notation, it refers to the user’s home folder. That is, ~/Library is the Library folder within the user’s home folder, i.e. /Users/username/Library.

  • How do you fix an ipod that has a black screen and it turns on but when it turns on the screen gets a lighter black but you still can't see the apps or anything?

    How do you fix an ipod that has a black screen and it turns on but when it turns on the screen gets a lighter black but you still can't see the apps or anything?

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Restore from backup. See:                                 
    iOS: How to back up                                                                
    - Restore to factory settings/new iOS device.
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
      Apple Retail Store - Genius Bar              
    Apple will exchange your iPod for a refurbished one for this price. They do not fix yours.
    Apple - iPod Repair price                       
    A third-party place like the following maybe less. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens
    Replace the screen yourself if you are up to it
    iPod Touch Repair – iFixit

Maybe you are looking for

  • Reports 6i against 10g database

    Hi, We are upgrading our database from 9i to 10g. We are running our reports (6i) against 10g database in the batch mode. For some of our reports we are getting the following error: REP-0736: There exist uncompiled program unit(s). REP-1247: Report c

  • Safari will not open PDF files and links

    I know this has been posted before, but I have tried every suggestion including downloading and reinstalling Safari and Adobe Reader.. When I click on link to pdf file/document in Safari I get a new page but it opens as blank and black. This issue do

  • Vendor and Customer Hard and Group Currency balances

    Please let me know the table names of Vendor, Customer and GL balances for Hard and Group currencies (Ex KNC1 for Customer balance in Company Code Currency) Ramesh

  • Problems with datatypes while callling MS-SQL stored procedure

    Hi     We have a stored procedure in MS-SQL server ( Sql Server 2000 ) that we are invoking from XI 3. ( SP18) using a receiver adapter communication channel . One of the parameters of the stored procedure has a decimal data type . In XI design time

  • My iPod deleted everything on it too!

    My sister gave me an ipod nano for my Birthday at the end of August. Knowing me well, she preloaded it with hundreds of tunes. I have recently visited the US and at my transfer airport on my return I found the device empty. I had not plugged it in to