This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Use List from JSTL to Scriptlets  RSS feed

 
vivek dhiman
Ranch Hand
Posts: 155
Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I want to use the list element inside my scriptlet. Below is my code which is not working.


How can i access social var inside scriptlet.

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you do that? The JSTL and EL were meant to replace scriptlets 12 years ago. They are not meant to be used together.

If you are using a super-modern version of JSP, you can make general function calls with JSTL and EL. Otherwise you should either refractor the bean to use properties rather than general function calls, or explore defining an EL function, or simple custom tag.

Under no circumstances should you be using scriptlets, and certainly never mixing scriptlets with the JSTL and EL.
 
vivek dhiman
Ranch Hand
Posts: 155
Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I can apply the custom tag, but for the time being i have to do it early and the codebase is not setup yet.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don;t what set up you think you need to do. But whatever it is, that's the way to go rather than trying to write fragile code that will cause problems later. What version of JSP and El are you using? You may just be able to make the method call with the EL.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!