This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Question about MVC2 BeeServlet

 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the 2nd example code of BeeServlet we have in method init():


I do not quite understand what the first parameter ("default") is doing exactly.
In the API I read:

actionKey - The text that will be sent in the servlet parameter to kick off this action.



I think that init() starts class Default which then runs it's doAction() method. But what could class Default then do with param "default"?
Or would servletData be able to do something with it? And if yes, what??




Thank you for any enlightening hints!
 
Sheriff
Posts: 9109
12
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The parameter is passed when the jsp calls the servlet. If no parameter is specified, "default" is called.
 
Greenhorn
Posts: 6
Netbeans IDE Firefox Browser Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I posted a similar question. what parameter is set in the jsp?
 
Sheriff
Posts: 3064
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The parameter is "action", so something like http://<myurl>/BeeServlet?action=default is what you need. There's nothing significant about "default" though. The framework just assumes the first action handler added is the default one, and uses that one if it can't find an "action" parameter in the request.
 
Richard J Barton
Greenhorn
Posts: 6
Netbeans IDE Firefox Browser Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks. I got it now.
In a link action=desiredAction
In a form a button with a name of action and a value of desiredAction.
 
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic