Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

servlet and thread

Thread view: 
gk - 01 Nov 2005 14:15 GMT
i am  connecting  to a servlet. i am  passing some values from JSP to
servlet. the servlet gets those values from JSP by
request.getParameter(). then the servlet creates Threads as much as
values gives to it.

if the servlet is given 3 values from the JSP, then it would create 3
threads to calculate.

if the servlet is given 10 values from the JSP, then it would create 10
threads to calculate.

each Thread would return results to the JSP.

PROBLEM :
=========

how does my JSP would get the results from the threads. JSP would
refresh in 5 secs interval and would display the latest threads result.
gk - 01 Nov 2005 14:26 GMT
i tried to put a bean in the server-side so that each thread would pour
data into it.  but how does JSP would access that bean ? i am
refreshing the JSP in every 5 seconds interval.

i tried  bean with static methods. and accessed the bean in my JSP. but
that is producing  concurrency problems. (Not all the results are
coming out).

i also tried to put the threads results into session . but that too
also  not producing result.

how does my JSP would get the results from the threads ?
please suggest  example code.
regards
dnasmars - 03 Nov 2005 15:19 GMT
> i tried to put a bean in the server-side so that each thread would pour
> data into it.  but how does JSP would access that bean ? i am
[quoted text clipped - 10 lines]
> please suggest  example code.
> regards

hello,

how about trying to create an instance in the servlet
a sort of threadmanager this instance gets the parameters from
the jsp on one hand create thread instances that do the calculation.
when the thread finishes it returns the result to the threadmanager.
The instance of the threadmanager has to be session scope so that
the jsp each 5 sec can see the results in the threadmanager.

I hope this helps


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.