This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes JSP and the fly likes syntax for sending a jsp hashmap variable to a  jsp method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "syntax for sending a jsp hashmap variable to a  jsp method" Watch "syntax for sending a jsp hashmap variable to a  jsp method" New topic
Author

syntax for sending a jsp hashmap variable to a jsp method

laura mccord
Ranch Hand

Joined: Feb 10, 2009
Posts: 108
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

Joined: Jan 10, 2002
Posts: 61760
    
  67

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
laura mccord
Ranch Hand

Joined: Feb 10, 2009
Posts: 108
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

Joined: Jan 10, 2002
Posts: 61760
    
  67

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

Joined: Feb 10, 2009
Posts: 108
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.
 
jQuery in Action, 2nd edition
 
subject: syntax for sending a jsp hashmap variable to a jsp method