I've already read bunch of tutorials about jsp and servlet and I'm already aware of not using a scriplet inside a jsp. My problem is that i'm still confuse of the different tags and I don't know yet much of the functionality of the different tags.What tag would be use if I will call a servlet inside Jsp where that servlet is just simply execute something behind the scene, ie. not returning any variable.. , for example is Connection in Database.
chure abcede wrote:I thought we could just easily call and run a servlet in Jsp line with a Tag.
You actually can -- the <jsp:include> action can call any resource. It's just not considered a good practice. Common practice is to handle all data activity in the controller and to keep the JSP as "dumb" as possible.
what tag should I use or the preparation.
Again, no tag. Any data activity that needs to be performed should be done before the JSP gets invoked. Have you read this article which describes page controllers?
setAttributes place inside servlet and forward the response to JSP?
Pretty much. The controller does the data access, places the data into request scope, and the request is forwarded to the JSP which accesses the values via the EL and JSTL.
I tried it but I guess its only applicable if your passing a variable from a servlet to JSP.
What do mean by "only applicable"? This is always applicable when using accepted practices.
Are you not interested in following accepted best practices? Why would you want make it many times more messy than necessary, and therefore more confusing and fragile?
And, of course, you should modernize the JSP to use JSTL and EL, and not obsolete scriptlets.