This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Display label instead of id - easy? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Display label instead of id - easy?" Watch "Display label instead of id - easy?" New topic
Author

Display label instead of id - easy?

chris gar
Ranch Hand

Joined: Jul 20, 2002
Posts: 45
I have the following code:


It displays (for instance) "4" - for the id of the judge I want to display. I want to display "Johnson" -- a value saved in an ArrayList.

Can you help? I think the pseudo-code is something along the lines of:



I cant get the exact syntax ??? Can you help?
s penumudi
Ranch Hand

Joined: Nov 17, 2004
Posts: 113
I manot sure if you can user <bean:write> tag in scriptlet tag <%%>.

I guess you can do something like this.



hope this helps
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4446
    
    5

Doesn't the "result" bean have a property for the name as well? Why does name have to be kept separately?


Junilu - [How to Ask Questions] [How to Answer Questions]
chris gar
Ranch Hand

Joined: Jul 20, 2002
Posts: 45


hope this helps[/qb]<hr></blockquote>

Thanks for you help! - That gets me 1/2 of the way there. Now - I'm inside a <l0gic:iter> - I have the id but I cant get the array list - so i can do the arraylist.get(id)

I entered in the jsp:



Now I just need the String name = arrayList.get(courtActivityTypeID);

I can get the id just fine - but I don't know how to "grasp" the arraylist inside this iter loop. ???

The arraylist is in the CourtActivityClientChargeForm - I just cant grab it.

Thanks - any help is appreciated.

BTW: I had a lot of luck with using the struts tags in a html:select.



This works like a charm - but I need to output the value in a table - not a select box.




[ January 07, 2005: Message edited by: chris gar ]
[ January 07, 2005: Message edited by: chris gar ]
s penumudi
Ranch Hand

Joined: Nov 17, 2004
Posts: 113


result is the object of CourtActivityClientChargeForm. I am not sure why you are type casting it to CourtActivity?

If arrayList and id are fields of the CourtActivityClientChargeForm then you can do something like this.



From the html:select code, it seems like you have courtActivityType in your request scope then why don't you get the collection from the request object?. Just an alternate if you don't hold this arraylist in your form.

Hope this helps
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Display label instead of id - easy?
 
Similar Threads
logic iterate
In jsp page After decimal i need only 2 values(for ex:477.74)
bean value persists on clicking back
HTML tag
Problem in displaying table using struts logic:iterate tag