Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about MVC2 BeeServlet

 
juliane gross
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • 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!
 
Marilyn de Queiroz
Sheriff
Posts: 9065
12
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The parameter is passed when the jsp calls the servlet. If no parameter is specified, "default" is called.
 
Richard J Barton
Greenhorn
Posts: 6
Firefox Browser Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I posted a similar question. what parameter is set in the jsp?
 
Greg Charles
Sheriff
Posts: 2987
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • 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
Firefox Browser Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic