my dog learned polymorphism*
The moose likes Servlets and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark ""MVC" controller servlet" Watch ""MVC" controller servlet" New topic
Author

"MVC" controller servlet

malik ge
Ranch Hand

Joined: May 13, 2011
Posts: 69
Hi, I am new to Servlets and JSP
I have recently read about MVC model.
In the following example:



If the request is to "searchperson" the contrller calls the "searchPerson" method, and then this method instantiation the DAO class
and then redirect to "showperson.jsp"

I want to know what if I have more userActions. Then how does controller servlet should work?
Can I use
if(userAction.equal("...."))
{
//call some method or redirect to JSP
}

again again for ever request.

Thanks.
Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

malik ge wrote:

I want to know what if I have more userActions. Then how does controller servlet should work?


I dont understand what you mean by more actions


Ashwin Sridhar
SCJP | SCWCD | OCA
malik ge
Ranch Hand

Joined: May 13, 2011
Posts: 69
By "usreAction" I mean " String userAction = request.getParameter("action");" the action here is passed from JSP page

In above example the userAction is "searchperson"

The JSP:
<html>
<body>
<h3> Search Person </h3>
<form name="search" action="controller" />

<table border= '1'>
<tr>
<td> <h4> Name </h4> </td>
<td> <input type="text" name="name" </td>
</tr>

<tr>
<td colspan="2" align="center">
<input type="submit" name="action" value="searchperson">
<input type="reset" value="Clear">
</td>
</tr>

</table>
</form>
<body>
</html>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "MVC" controller servlet