Click to See Complete Forum and Search --> : Help ... How to call servlet from mouseover attrbute


tmunnich
05-24-2003, 06:20 PM
Hi,

I am trying to call a servlet when the onmouseover or onmouseout attribute is activated in the following jsp file:

<%
String tmp1 = "../servlet/test?text=bad";
String tmp2 = "../servlet/test?text=good";
%>

<form>
<input type=image name=img src=<%=tmp1%> onmouseout=<%=tmp1%> onmouseover=<%=tmp2%>
</form>

All this servlet does is create an image with the word 'bad' or 'good'. The image is an encoded jpg outputstream.

I have tried all kinds of things but somehow this does not work on the onmouseout and onmouseover attribute. The src attribute works like a champ.

Anyone any idea how I can make this work?

Thanks

khalidali63
05-24-2003, 06:28 PM
It sounds like a bad designe to me.
First of all you can not simply send and recieve an http request/response by only mouseover/out.
Second even if you could do it using some functions,sending an http request for onmouse over and out can really screw up the network,not to mention multiple requests in the same time frame for good and bad images.

That said,if you must implement this strange logic,then you will need to call amethod that will reload the page and forward the request to the servlet.