• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Scriptlet to EL

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a web form working great for a long time using Scriptlets and Bean in Tomcat 6.0.20.
Now I would like to eliminate the Scriptlets and use EL instead.
Please advise how I can get the below radio input to work with EL in my JSP. All my attempts are not working.

Bean that worked with the Scriptlet:


JSP works with Bean and Scriptlets:

My attempt to use EL instead of Scriptlet does not work with any of the below attempts. None of my EL attempts show any checked value or the check shows up only at the last radio button only.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Usually attempts to do a line-by-line replacement of scriptlets with EL are doomed to failure. Using modern JSP pages usually represents a change in thinking.

In your example, you are trying to call general functions with parameters from the EL. No can do. Only property fetching.

You might want to create some EL functions as a last resort, but I'd try to re-jigger things to do most of the work in the controller, and use EL properties on the page.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hint: consider the following example:


 
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote: You might want to create some EL functions as a last resort



I deduce from here that you are not the best friend of creating EL functions, could you explain a bit why?

I like functions as they are powerful but I feel as if I were tricking the JSP, it's a bit like adding scriptless but with 'camouflage' in my opinion.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Albareto McKenzie wrote:I deduce from here that you are not the best friend of creating EL functions ...

Hardly! I love EL functions! But they should only be created when necessary because what needs to be done can't be done using the EL, or creates hard-to-maintain code.
 
Albareto McKenzie
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok! I missunderstood you, thanks for the reply.
 
reply
    Bookmark Topic Watch Topic
  • New Topic