Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Controller servlet  RSS feed

 
aliya sharma
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I have a simple application where user enters a part_no to get the contents belonging to that part_no. I have a servlet that passes the parameter to java bean and then shows the result on JSP. I want to update the results when they are shown on the JSP. I know how to do it by creating another servlet for that request, but i want to be able to use my existing servlet. I think that would make my servlet Controller. How do i achieve that. I don't want to use struts as i want to get my basics down before i move on. COuld someone please give me a sample code or a link to tutorial on how to achieve this. Even some pointers to get me started would be greatly appreciated. Thanks for your time.
 
Manoj Gundawar
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I guess you can do it by invoking the same Servlet from JSP but passing different parameters. You can have a parameter called "action" and based on its value same servlet would perform different processing.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Manoj Gundawar:
Hi,
I guess you can do it by invoking the same Servlet from JSP but passing different parameters. You can have a parameter called "action" and based on its value same servlet would perform different processing.


yeah, if we name it then it could be known as command pattern. do some reading on Command Pattern. I hope you will get a clear idea.
 
aliya sharma
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
THanks for your response guyz..I was doing it the "action" way like you described..just wanted to make sure that was the correct approach..Again, thanks for your input
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!