Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

syntax for sending a jsp hashmap variable to a jsp method

 
laura mccord
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • 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

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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: 108
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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: 108
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic