This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 61084
    
  66

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: 61084
    
  66

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: syntax for sending a jsp hashmap variable to a jsp method