• 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

syntax for sending a jsp hashmap variable to a jsp method

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a <c:forEach> loop that loops through a hashmap. I also have a jsp method in my page in which I need to send a value to this method.

This is what I have but I can tell that I am not passing the value correctly.



Can someone tell me how the syntax works please?

Thanks

 
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
Mixing JSTL and EL with scriptlets?

That's just a mess! Use one or the other.

Look into creating EL functions. You declare them in your TLD just like custom tags
 
laura mccord
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh ok. I didn't realize it was a mess. I guess I'll look into EL functions.

Thanks.
 
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
The whole purpose of the JSTL and EL are to replace scriptlets in JSPs, which have been discredited since 2002. They were never meant to work together, and while you might be able to shoe-horn them into the same page, it's never pretty.

You might also want to use a custom tag for whatever that method is doing.
 
laura mccord
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I think I almost have it working but now I have an error: Caused by: org.apache.jasper.JasperException: Method "space" for function "space" not found in class "my.company.directory.functions.Utility"

Here is my tld:



my class file:


and my jsp:


and I even added the entry to the taglib in my web.xml file



I can't think of what I could be missing unless things are getting confused since this is a portlet mvc project.

THanks.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic