servlet and thread  
Author Message
gk





PostPosted: 2005-11-1 21:15:00 Top

java-programmer, servlet and thread 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





PostPosted: 2005-11-1 21:27:00 Top

java-programmer >> servlet and thread 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





PostPosted: 2005-11-3 22:19:00 Top

java-programmer >> servlet and thread gk wrote:
> 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