SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Nitin Bombay wrote:Hi ,
Can any one suggest how to write validation and bussiness logic in servlet for jsp form
Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
hi please suggest how to implement the validation in servlet as we do in jsp with javascript function ,if possible give exampleNishan Patel wrote:
Hi,
POJO means Plain Old Java Object. Our Simple Java class which contains variable declaration and getter and setter method with no argument constructor that is our POJO class.
Generally MVC model flow like
Jsp --> Servlet -- > Servlet call your business logic which is your java class then Servlet get result from business class --> finally Servlet pass to jsp.
So servlet serve as Controller.
Java Class represent Business logic.
Jsp contains view Part.
Nitin Bombay wrote: hi please suggest how to implement the validation in servlet as we do in jsp with javascript function
Nishan Patel wrote:
Hi Nitin,
If you want to suggestion for business logic then use same way as Ankit Garg says.
But make another POJO Class for your business logic.
Make object of that class and call method which contains all your business logic.
So, that is good practice for development and you are using MVC architect for development.
Then don't use HTML code in your Servlet make one separate jsp which contains basically your view part.
From the servlet make one requestdispatcher object and call forward method which pass your request to jsp and display it.
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Bauke Scholtz wrote:You may find this article useful to get some basic ideas out: http://balusc.blogspot.com/2008/07/dao-tutorial-use-in-jspservlet.html
SCJP, SCWCD.
|Asking Good Questions|
Nitin Bombay wrote:
Bauke Scholtz wrote:You may find this article useful to get some basic ideas out: http://balusc.blogspot.com/2008/07/dao-tutorial-use-in-jspservlet.html
Hi,
Thanks for suggestion, But i want to check validation for inserting data into database .the value need to be insert from Jsp and validation( such as allow only string ,allow only numeric value) need to be check in servlet .please suggest with example
Bauke Scholtz wrote:
Nitin Bombay wrote:
Bauke Scholtz wrote:You may find this article useful to get some basic ideas out: http://balusc.blogspot.com/2008/07/dao-tutorial-use-in-jspservlet.html
Hi,
But here(in the tutorial) no jsp page is given ,Please suggest how to insert data from jsp form .
Bauke Scholtz wrote:
Nitin Bombay wrote:
Bauke Scholtz wrote:You may find this article useful to get some basic ideas out: http://balusc.blogspot.com/2008/07/dao-tutorial-use-in-jspservlet.html
Hi,
Thanks for suggestion, But i want to check validation for inserting data into database .the value need to be insert from Jsp and validation( such as allow only string ,allow only numeric value) need to be check in servlet .please suggest with example
That's already covered.
SCJP, SCWCD.
|Asking Good Questions|
Nitin Belaram wrote:
Bauke Scholtz wrote:
Nitin Bombay wrote:
Bauke Scholtz wrote:You may find this article useful to get some basic ideas out: http://balusc.blogspot.com/2008/07/dao-tutorial-use-in-jspservlet.html
Hi,
Thanks for suggestion, But i want to check validation for inserting data into database .the value need to be insert from Jsp and validation( such as allow only string ,allow only numeric value) need to be check in servlet .please suggest with example
That's already covered.
Please suggest how to insert data from jsp form .As in the tutorial no jsp page is given
Willie Smits can speak 40 languages. This tiny ad can speak only one:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|