Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

How to pass enum values from jsp page to Servlet  RSS feed

 
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All

I'm Using MVC 2 architecture in that from every jsp page im having one hidden value like ex:


so when i pass to controller there im converting act value into int and depending on that value corresponding case statement in switch will be called for further action

now im using enum values i had declared enum class file in that i had declared the constants
like

so how can i pass this value in every jsp page

im trying to pass in hidden value so that in servlet i'm getting it as string so that i cant convert to enum type how to over com this problem..?
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hey in your controler you can convert request enum string to enum using



or

 
santhosh.R gowda
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mohan

 
Marshal
Posts: 67163
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A switch? Using numbers to represent actions? Not good.

I highly recommend learning about the Front Controller pattern.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!