I am writing the following code in each and every class but want to create a method that do the same thing to get me rid off of writting each time in every class. I tried a lot but failed
Filters can work on the data coming into your web application, or on the data leaving your web application. As such they can be used for such things that are common to all your code such as security on the way in, and setting the correct header information on the way out (although there are often better ways to do the later).
Andrew Monkhouse wrote:Filters can work on the data coming into your web application, or on the data leaving your web application. As such they can be used for such things that are common to all your code such as security on the way in, and setting the correct header information on the way out (although there are often better ways to do the later).
Thanks for recomending tutorials and books but can you please solve my real problem right now as the project is in my hand and I have to deliver it within a few days. I believe the methods are still workable in java servlet but certainly will start with recomended books/tutorials
Nobody here is going to write your code for you. I showed you one way to fix your method, including using a constant to define the attribute name, and using a third-party library to do the null/empty check. To be honest, I expected the code I wrote to be self-explanatory--I'm kind of at a loss to explain it any further without doing *all* your work for you, which is something we really try not to do here.
Farakh khan
Ranch Hand
Joined: Mar 22, 2008
Posts: 672
posted
0
David Newton wrote:Nobody here is going to write your code for you. I showed you one way to fix your method, including using a constant to define the attribute name, and using a third-party library to do the null/empty check. To be honest, I expected the code I wrote to be self-explanatory--I'm kind of at a loss to explain it any further without doing *all* your work for you, which is something we really try not to do here.
I am really thankful for you as you at least tried to help. Appreciated!
Its throwing compile time error not runtime or logical errors
Anyhow working with it and if I succeeded will let you know
I wrote the method the way *I* would have written it (well, with the caveat that this isn't how I'd do it). Obviously since I'm writing it the way *I* would write it I used the techniques and libraries *I* would use. You're not using them. So replace the stuff that you *don't* have with the stuff you *do*. It's really clear what the intent of the code I used is, or at least it *should* be.
Farakh khan
Ranch Hand
Joined: Mar 22, 2008
Posts: 672
posted
0
David Newton wrote:I wrote the method the way *I* would have written it (well, with the caveat that this isn't how I'd do it). Obviously since I'm writing it the way *I* would write it I used the techniques and libraries *I* would use. You're not using them. So replace the stuff that you *don't* have with the stuff you *do*. It's really clear what the intent of the code I used is, or at least it *should* be.
Thanks again for guidance. Will let you know about the progress soon