aspose file tools*
The moose likes Servlets and the fly likes servlet dispatcher not works Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet dispatcher not works" Watch "servlet dispatcher not works" New topic
Author

servlet dispatcher not works

kumar amara
Greenhorn

Joined: Oct 27, 2009
Posts: 24
Hi!
Greetings!
i want to develop a web application with
--> 2 jsps hidden values as 1, 2 as stepnum
-->servlet will see the stepnum then it calls a method according to that
-->that method saves the form data in jsp in to mysql db

mysql db driver in lib folder palced.
But it is not storing in the db & also not returning result jsp apge
One more doubt why if any form data left blank that value not storing as null in db Bcz for my simple application I realised that all fields hsould be entered why?
jsp page

servlet


Note:some code edited by me due to the ambiguity caused.
Thanks for the support not simply!
Why it is not possible to simply leave the rules for handling the user form fields which we allow him to left them.
and the db will have null ,the problem for tomcat or servlet or db i heard any lefted form fields are not treated as empty string is it true?
and ... thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
Good grief - there's a method with 63 parameters

This is way too much code for anyone to go through - what's a DB schema got to do with servlet dispatcher issues? Please edit your post and remove at least 90% of the code that's irrelevant to the issue; that'll increase the chances of someone looking at it in detail.
Nicola Garofalo
Ranch Hand

Joined: Apr 10, 2010
Posts: 308
It's very difficult to follow those gazillion lines of code. Could you please put your code on diet? I mean, could you please report just the lines you assume are not doing what they are suppose to do?

if you agree, we can try to solve the Sql problem first.

Do you get any SQLException ? if it's so, where?


Bye,
Nicola
kumar amara
Greenhorn

Joined: Oct 27, 2009
Posts: 24
First sorry for the inconvenience !
let me tell you in words
1) check the user input in servlet with if condition for stepnum=1/2
2)if 1 then call the utility method with the other parameters we got from the same jsp page
3)in that utility call a method to connect to db and return status
3)display that status to result.jsp (dispatch)
same for if (stepnum="2")
it will call another method in the same utility classes


kumar amara
Greenhorn

Joined: Oct 27, 2009
Posts: 24
i frogot no sql exception error occured /displayed
just not dispalying any error & not result.jsp and not data inserted.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
The point is not that people might not understand what the code is about, the point is that most of the code you posted can't possibly be related to the issue at hand. So why make anyone try to go through it?

As a side note, I see there are string comparisons using the "==" operator - that's not how strings are compared, you should use the "equals" method instead.
Nicola Garofalo
Ranch Hand

Joined: Apr 10, 2010
Posts: 308
I found one first problem.

In your jsp you specified a property of your form



I don't see any file to upload so delete it.
If you don't, the servlet doesn't receive the request parameters. Better, it receives them null

Please, begin to try that and see what happens.
Nicola Garofalo
Ranch Hand

Joined: Apr 10, 2010
Posts: 308
Yes, please Kumar, in your bean we need to see just s2Main method. You can delete the others.
We don't need to see web.xml (it's right i can guarantee) and the table creation, at the moment.
And if you can,please delete all those unuseful comments, they are just rumors to our understandings
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet dispatcher not works