Home arrow static arrow Java Programming [Archive] - help on programming multi-thread - please
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - help on programming multi-thread - please
This topic has 17 replies on 2 pages.    « Previous | 1 | 2 |

Posts:37,103
Registered: 3/30/99
Re: help on programming multi-thread - please  
Jul 26, 2004 8:22 AM (reply 15 of 17)



 
hi jverd
just have one more question to ask about
synchronization in jsp, and i will stop bugging you
for a while.
let's say in the jsp i need to display/update/insert
information from/to DB. because of the concurrency, i
will need to synchronize the access so that each
request to the page has the correct information. most
samples i have seen don't have the syn on the page. i
was wondering if the synchronization is done somewhere
else other than in the page. is it a good practice or
idea to have jdbc stuff coded in the jsp? thanks.

I try not to put any Java code in my JSPs. (Maybe the occasionly <%= fooBar()%>) All the DB access and business logic should be done in layers behind the JSP. That code shouldn't even know that it's running in a Servlet/JSP environment.
 

Posts:781
Registered: 5/1/01
Re: help on programming multi-thread - please  
Jul 26, 2004 8:58 AM (reply 16 of 17)



 
so, the jsp should act as a controller as well. it is just convienent for developers to generate html for displaying. this totally makes sense. the reason i am asking is that most samples i have read and seen have coding, and some even have heavy coding for accessing db, etc.. i suppose those are not intended for concurrency purpose, they are merely for the demonstration of the technology.
 

Posts:37,103
Registered: 3/30/99
Re: help on programming multi-thread - please  
Jul 26, 2004 9:01 AM (reply 17 of 17)



 
You can put all kinds of Java inside your JSP. But it's generally a bad idea. The JSP should really just be for display. If you have an occasional very small snippet to get some value into the HTML, then that's okay, but you want to separate your display (the JSP) from the logic that drives the display.

If you've seen JSPs with lots of Java in them, I'd probably call them poorly designed JSPs.
 
This topic has 17 replies on 2 pages.    « Previous | 1 | 2 |