hello
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?
thank you!
-
how can i use tag library in the mvc? (4 messages)
- Posted by: zhebin cong
- Posted on: March 01 2002 11:49 EST
Threaded Messages (4)
- how can i use tag library in the mvc? by Weston Aiken on March 01 2002 18:51 EST
- how can i use tag library in the mvc? by zhebin cong on March 02 2002 07:17 EST
-
how can i use tag library in the mvc? by Weston Aiken on March 02 2002 07:39 EST
- how can i use tag library in the mvc? by Thomas Tang on March 04 2002 03:48 EST
-
how can i use tag library in the mvc? by Weston Aiken on March 02 2002 07:39 EST
- how can i use tag library in the mvc? by zhebin cong on March 02 2002 07:17 EST
-
how can i use tag library in the mvc?[ Go to top ]
- Posted by: Weston Aiken
- Posted on: March 01 2002 18:51 EST
- in response to zhebin cong
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... -
how can i use tag library in the mvc?[ Go to top ]
- Posted by: zhebin cong
- Posted on: March 02 2002 07:17 EST
- in response to Weston Aiken
thanks
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? -
how can i use tag library in the mvc?[ Go to top ]
- Posted by: Weston Aiken
- Posted on: March 02 2002 07:39 EST
- in response to zhebin cong
Thats right.
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.
cheers
-
how can i use tag library in the mvc?[ Go to top ]
- Posted by: Thomas Tang
- Posted on: March 04 2002 03:48 EST
- in response to Weston Aiken
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)
Thanks.
Thomas