Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
santhosh.R gowda
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..?
 
Mohanasundar Nagarajan
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

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!