It's not a secret anymore!
The moose likes Cattle Drive and the fly likes Question about MVC2 BeeServlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Question about MVC2 BeeServlet" Watch "Question about MVC2 BeeServlet" New topic

Question about MVC2 BeeServlet

juliane gross
Ranch Hand

Joined: May 30, 2002
Posts: 161
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

Joined: Jul 22, 2000
Posts: 9059
The parameter is passed when the jsp calls the servlet. If no parameter is specified, "default" is called.

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Richard J Barton

Joined: Feb 07, 2012
Posts: 6

I posted a similar question. what parameter is set in the jsp?
Greg Charles

Joined: Oct 01, 2001
Posts: 2968

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

Joined: Feb 07, 2012
Posts: 6

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.
I agree. Here's the link:
subject: Question about MVC2 BeeServlet
It's not a secret anymore!