servlet and thread

G

gk

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.
 
G

gk

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
 
D

dnasmars

gk said:
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
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top