Wednesday, March 30, 2011

JSP -- default value for EL functions arguments

Is there a way to have default values for EL functions arguments (e.g., optional arguments)?

From stackoverflow
  • you can make your own tags, which supply these values that will wrap the functions you are trying to call. JSP2.1 has .tag files that are basically jsp files, and it would be VERY easy to define default values using those.

  • I'm not sure if I understood. I want to use my functions as functions - ${f:get(...)}, not as tags. How can I assign a default value to an EL function using a .tag file?

  • Expressions like this?

    #{foo.bar('argument')}
    

    No, at least not yet. This is proposed for JSR 245, which should be part of Java EE 6. Kin-Man Chung explains here.

0 comments:

Post a Comment