Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

"MVC" controller servlet

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 277
Oracle Spring Flex
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>

 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic