Hello,
as there was no reply from anyone to my post and I was trying to resolve this issue whole day and finally Succeeded and resolution is as follows,
Hidden Field added into the form to populate Confirm functions return value and then it is used to call fun1 or fun2.
java code is as follows .
Problem is resolved now, we have return value in the hidden field now.