Forums Register Login

enum in JSP EL & JSTL

+Pie Number of slices to send: Send
Hi All,

I want to use enum in jsp using EL & JSTL, below is code,



above code OWN is hardcoded string in EL,
Instead of using hardcoded string want to use a enum PaymentOerationType having all possible values of payment type.
I am not able to use PaymentOerationType.OWN directly in EL.

How can I deal with emuns in EL or JSTL?
+Pie Number of slices to send: Send
You cannot directly access the enum. What you can dois to use the values() method of the enum to gather the enum values into a Map or List and use it on the page by placing it in request scope.
+Pie Number of slices to send: Send
Hi Bear,

Thanks for reply.

It worked way you told, but just one question in my mind why EL or JSTL does not support a enum?

+Pie Number of slices to send: Send
Dunno. They didn't consult me during the specification phase.
+Pie Number of slices to send: Send
:) I was thinking might be some technical reason for that you might know.
anyways thanks.
Yeah, but is it art? What do you think tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 6014 times.
Similar Threads
JSTL doubts (c:if)
Enums in JSPs
Help in JSTL And EL
How can I consolidate some duplicate JSTL code in my JSP?
JSP Struts/JSTL Form problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:53:24.