you should not have Java code in your JSP like that.
Your form should submit to a servlet which will call a service that returns a List<SomeModel> that can then be forwarded to the JSP page for display, allowing you to use JSTL to format it.
That way you disconnect your display stuff from the Java code, and can test each bit and (hopefully) isolate any issues.
Rahul kumar verma wrote:Its work when created in new project as well change the file name and run directly jsp page then it also work...
Programming is not about how to get a solution.
It is about how to get a solution in correct way.
What Dave explained is the correct way of doing things in web application.
Rahul kumar verma wrote:Sorry for my side Tapas and Dave because I'm using scriptlet only of JSP and according to that fetching data from database on click buttom
Yes I understand.
That is why we are suggesting you to rectify these practices.
Using scriplet is tempting and is OK in very small JSPs.
Once you are in actual projects and size of application increases, it will be very difficult to maintain and debug.
Separating the view and the logic will make your life easier.
And EL has been the standard in JSP since 14-15 years. Scriplets should be avoided.
Do not use Java code in your JSP. It's been obsolete for 15 years. Do not uppercase your HTML. That's also an obsolete practice that makes the code harder to read.
See your other post with regards to learning how JSP works. I think you are having the same problem here.