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.
oh I see. I thought we could just easily call and run a servlet in Jsp line with a Tag. So Sir Beau,if that's the case, what tag should I use or the preparation. Are you referring for the JavaBeans tag and setAttributes place inside servlet and forward the response to JSP?[based on BeerSelect.java :). I tried it but I guess its only applicable if your passing a variable from a servlet to JSP.
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.
Oh.. I see.. there is a misunderstanding. : ) . I'm referring about the use of setAttribute, hence it is passing a variable object. Of course sir Beau, I would love to follow the best practices and also consider learning JSTL and EL. I'm still reading the tutorial you've shared to me. It's a great book maybe its just me who can't catch up easily in JSP :(.