• Post Reply Bookmark Topic Watch Topic
  • New Topic

Scriptlet to EL  RSS feed

 
Joseph Smithern
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hint: consider the following example:


 
Albareto McKenzie
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok! I missunderstood you, thanks for the reply.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!