cancel
Showing results for 
Search instead for 
Did you mean: 

Communication between applet and bean

p3d3r0s0
Champ in-the-making
Champ in-the-making
Hey,
I'm trying to change a file's content through an applet (so i can do it on the client's side). My idea is to have a jsp where you press a button and the backing bean sends the file's noderef to an applet and it changes the file and sends back the new file's content to the backing bean.

1- Is this possible?
2- How can I access the file's content in the applet (send it's inputStream has a parameter?)
3- How can I send the file's content from the applet to the backing bean?

I believe I solve the second problem with information from this post http://forums.alfresco.com/en/viewtopic.php?f=48&t=18828&hilit=applet, but how can I solve the third problem?

Best reguards,
Pedro
11 REPLIES 11

savic_prvoslav
Champ on-the-rise
Champ on-the-rise
hi, I did not see other code but you should use
http://hc.apache.org/httpclient-3.x/

hire you have some example http://hc.apache.org/httpclient-3.x/tutorial.html

use this from your applet.

p3d3r0s0
Champ in-the-making
Champ in-the-making
Well, looks like my problem was that i needed an inputstream in the applet for the response from the servlet.
the POST method in the servlet wasnt being used because of this, which seemed kinda dumb since i was using this:

         servletConnection.setDoInput(false);

but im new to this, so this method probably does something else….
in any case i can now send a string from a servlet to a applet and vice versa.
all i need now is to try sending info to a bean from the servlet Smiley Happy

EDIT: Actually, i think all i need now is to send the nodeRef of the file/document that im currently looking at. I already got the nodeRef in the backing bean from the parameters map, but how do i send that nodeRef to the servlet?

EDIT2: This was simpler then i thought… All i needed now was to put a static method on the servlet class that had a String as a parameter (for the nodeRef) and invoke that method from the bean…

Ps: thanks Savic and Gyro for your help Smiley Happy