This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Unable to understand the flow of simple app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Unable to understand the flow of simple app" Watch "Unable to understand the flow of simple app" New topic
Author

Unable to understand the flow of simple app

Joy Vergis
Ranch Hand

Joined: Sep 14, 2009
Posts: 45
New bee to Servlets.

Flow: index.html -->GreetingServlet -->sucess.html

fields: (in index.html)
firstname: txtbox
surname: txtbox
submit button

GreetingServlet checks below:


sucess.html: plain html page

web.xml:



index.html:



my understanding of application flow is : When i click on submit button, depending on the name mentioned for action attribute in index.html file corresponding <servlet-name> is checked in the web.xml file. and the particular servlet processes the request as per the method attribute mention in the index.html.

Am i write?

Also want to know how the execution proceeds when i replace with "/GreetingServlet" for action attribute in the index.html page as I get an error and not able to proceed
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

You are absolutely not rong, sorry, wrong.

That is what is happening. You post the fields in a query string to the Servlet that answers on the pattern /GreetingServlet. It then processes the request, like looking for the mandatory name fields.

I don't know how the rest of your Servlet class post-method looks like. But that should work. If you change the action url, then you also need to change or add the mapping to the servlet so that it knows that it is supposed to react on the call.

And one little thing... try to use positive programing.

The code:


should, imho, be rewritten as

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to understand the flow of simple app