hello friends, now i am going to describe the problem i am phasing
actually i have embedded japplets in a jsp page(appletjsp) and want to communicate japplets indeed jsp to a servlet in the diffrent derectory but in same context root. moreover, i have written code at applet and servlet side both. actually there is a next button in one of japplets(embedded in appletjsp) and i have written the code(for servlet communication) inside button's mouse clicked event. and at servlet side, as usual i have got an inputstream from request and want to forward this request(after getting request dispatcher) to another jsp page. actually i am proposing to run this jsp page after clicking next button from appletjsp .
now the problem that made me a bit confused is that when i click next button after running jsp page(containing japplets) then neither there is any error/exception at server/IE's sun java console nor any effect of code at servlet side.
actually i am not sure that the servlet side code does not make any effect rather it is ony my assumption.
although i am very new in java and as what i know, to send back response to client side, servlet class needs to be run at server side and probabbly for that there must be a sepreat request from client's applet to server(please dont flame me if i am wrong).
so please tell me how can i get another jsp page(to which i trying to get request dispatcher)running after clicking next button?
although this topic has been made too long, even then please fix my problem.
Joined: Nov 04, 2007
my above problem ha been solved, i given response to applet and retrieved it at applet side through ObjectInputStream. and now it is working.
but why it was not working before? is it must to open InputStream at applet side to retrieve data, sent back by servlet as response?
one more thing my intention is to 1) user enter data in an applet which is embedded in jsp then 2) click submit and send it to a servlet then 3) forward those to another jsp page.
but with this i am getting java.io.streamCurrupted Exception at sun java console in the line where i tried to get ObjectInputStream in applet side to retrieve data back that is sent from servlet.
please make a quick response to solve this problem
The code performs a RequestDispatcher.forward, and afterwards does something with the output stream - that won't work. You can only do one of these things, not both - either forward the request, or handle it by writing to the output stream.
probabbly you are suggesting as what i got is that i should open an ouputstream to communicate to target jsp. if it seems to be possible like applet servlet communication then i will try it.
thanks a lot
Joined: Nov 04, 2007
hello friends one second,
i have tried whatever i wants by,
1) sending data by post method from applet to servlet then 2) storing those in a bean in session scope(to retrieve back from target jsp in the same session) then 3)as Mr Ulf said above that at servlet side i can use only one(either forward or write to ObjectOutputStream) therefore i wrote to outputstream and read it back from applet then
3) from the same applet after reading data i tried to open target jsp using appletcontext.showdocument method then
4)in target jsp i intantiated the bean in which i had stored all data from servlet, in the same session scope.
but when i tried to get the properties value then i got following exception at server side
here sfirst_name is a property field.
if i am going right on my stupid way, then please tell me how can i display all the datas back as feedback on a target jsp?
[ November 20, 2007: Message edited by: John Mclain ] [ November 20, 2007: Message edited by: John Mclain ]
Joined: Mar 22, 2005
probabbly you are suggesting as what i got is that i should open an ouputstream to communicate to target jsp.
Using streams from within a JSP page will not work. JSPs are for generating text, not binary data; you'll need to do this from within a servlet.
Joined: Nov 04, 2007
thanks Mr Ulf, i got it
i am not doing so what you are prohibiting for. i used a dirrent approach instead. and that i have explained already in my previous reply.
please take a look over there and catch how much i am right on my way?