Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-06-2009, 06:21 AM
Member
 
Join Date: Jul 2009
Posts: 8
Rep Power: 0
lisa.lipsky is on a distinguished road
Default JSP functions and Java Bean methods
Hi all,

I'm new to jsp and I have a question that I couldn't find an explanation for.
I want to know why most functions are written inside Java Beans instead of JSP pages.
I know this may sound like a silly question but if I can have clarification to my confusion, I'm entirely grateful.

Regards,
Lisa
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 07-06-2009, 09:27 AM
Senior Member
 
Join Date: Dec 2008
Posts: 164
Rep Power: 2
dswastik is on a distinguished road
Default
JSP should be primarily used for the presentation purpose. We should avoid writing our business logic, data access logic etc. inside jsp pages, rather we should put them in java classes. Moreover if you look on this also makes our code modular. If you have to make any changes in business logic or data access logic you dont need to do any thing in the jsp page, and on the contrary if you have to make some changes in the presentation part you will just make changes in the jsp page, you dont have to do any thing with the java classes.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-07-2009, 02:52 AM
Member
 
Join Date: Jul 2009
Posts: 8
Rep Power: 0
lisa.lipsky is on a distinguished road
Default
What if I write the inside one jsp, for example logic.jsp and has all my other jsp pages include logic.jsp? Is this advisable?
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-07-2009, 06:47 AM
Senior Member
 
Join Date: Dec 2008
Posts: 164
Rep Power: 2
dswastik is on a distinguished road
Default
No. Because as per MVC-II what you mostly follow in web application these days, three different things had different usage. Model->Bean classes,other helper classes
View->output what the user gets (Generated through jsp) and controller->Servlet.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 07-07-2009, 08:29 AM
Member
 
Join Date: Jul 2009
Posts: 8
Rep Power: 0
lisa.lipsky is on a distinguished road
Default
OK. Now I know why most business logics are written in Bean. Thanks.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
stateless session bean with methods mihael Enterprise JavaBeans 1 01-15-2009 09:55 PM
Calling java functions from c++ khajalid New To Java 11 10-20-2008 05:29 AM
UREGENT-accessing session bean ok but entity bean parimal Enterprise JavaBeans 1 08-28-2008 02:34 PM
java copy paste cut and undo functions Mr tuition AWT / Swing 1 12-09-2007 01:02 AM
How to use Inner bean definitions via nested bean elements JavaBean Java Tips 0 09-26-2007 09:36 PM


All times are GMT +2. The time now is 05:28 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org