Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"MVC" controller servlet

 
malik ge
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 277
Flex Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
malik ge
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic