in some tag libraris such as jakarta tag library and jrun tag library,there is database
access tag, it provide convenient function to access database from jsp page,but i wonder how can i use such a tag within MVC architecture.
as we know,in MVC architecture,all requests from the jsp pages are submit to the controller servlet,then the controller manipulate ejb to access database,it don't allow the database access from the jsp page.
who can tell me how can i combine the tag library with mvc architecture appropriately?
Thats the idea for MVC...the JSP should know nothing about your business logic or data model.
In the MVC architecture, tag libraries are best used for presentation logic only. You would POST to your controller servlet which passes the request to an appropriate handler class. The servlet(or the handlers) then package the results into beans that are forwarded to the JSP pages for presentation.
You may want to check out Apache's Struts Framework that does what Ive described.
Hope that helps...
so that some tag such as database access in the tag library is useless in the mvc architecture,is that right?i think most web program use mvc architecture,i wonder when i use the tag mentioned above?
Those type of tags are nice for the page centric model (model 1), where the JSP pages are the controllers and the presenters. Using that model, its tempting to put the code right in the page, which you know works, but can get out of control. I guess tags like the db tag are also good for prototyping and proof of concept projects where you need something running quick.
I've never used the proprietary tag libs you are talking about. I have used my own proprietay design though :-) . What I did is that I bind the tag values to EJB the same way the controler should (there are a lot of details but you know the idea). Question, so did you mean these tools (db tags from apache's tag lib) actually persist the values to db directly for you? (sounds like pretty bad design, I mean, maybe a bit better than applet)