There *IS* an easy way... don't use all the taglibs! :)
It always amazes me how people will bend over backwards working with custom tags to do things that would be simple as hell with scriplets, all in the name of "clean code" and "complete separation of presentation from everything else". While it's certainly true that you can abuse scriplets in the extreme, it's also true that judicious use of well-written code in JSPs can be just as easy as all the extra custom tags (and in some ways easier because you can see what's going on right there, no need to go look up what the tags do, or even worse, look at the code that's behind them).
Sometimes taglibs make life a lot easier and make code cleaner, but just as often (based on my experience at least) they just get in the way and add a lot of unnecassery complexity. I can't say for certain if that's the case here because as you say there might be an incredibly easy way to make it work as your doing it, but I personally would be thinking of just not using the custom tags at all.
(Sorry, I forgot to surround this in custom <soapbox> tags...)
Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies www.omnytex.com
From: Steve Lianoglou <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Working with hashmaps in my Jsp Date: Wed, 15 Sep 2004 18:36:29 -0700
How do I use a dynamicaly generated "key" to pick off something in my hashmap?
The story is that I am iterating over a collection of keys into a hashmap.
In my iteration, and after doing some present/notPresent logic, I am pulling an object out of my HashMap, so here is a reduced example of what is happening.
Lets call my HashMap hash
and my Collection of keys, "keys" .. both of these are put into my request scope through my action
so at the end of the action, imagine a request.setAttribute("hash", hash);
request.setAttribute("keys", keys);
Ok .. now in my jsp i am iterating over my keys collection, if the key in my Collection passes some type of logic, then i want to pull the object associated w/ that key in my hashmap out and use it, so a very simple example is this:
<logic:iterate id="hashKey" name="keys">
<%-- now "hashKey" has the string of the key into my hashmap that I do some testing with --%>
<%-- do some logic, if i like what I see, I want to pull the object at location "hashKey" out of my HashMap --%>
<bean:define id="hashObejct" name="hash" property="hashKey" />
<%-- do some other with hashObject --%>
</logic:iterate>
That's all I want .. all I want is for the property attribute in my <bean:define> tag to be recognized as a dynamic varialble, and not look up in my "hash" HashTable for a literal key "hashKey" but no matter what I'm doing, no way no how can I get it to work.
I feel like I'm trying to reach over my shoulder to scratch my ass here, because I *know* there must be a mind-nummingly easy way to do this which I'm missing.
Any help is appreciated.
Thanks, -steve
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]