I have a JSP page with a form inside of it. 'onSubmit' of the form, I want to invoke a java function with a value of the form.
I am adding part of my code here:
<form action="www.yahoo.com" id="hiddenform" name="hiddenform" method="post" onSubmit="<%getResponseValue(out.println("><script>this.ResponseType.value</script>"));%>">
<select name="ResponseType">
<option value="Default">Default</option>
<option value="Sucess">Sucess</option>
<option value="Failure">Failure</option>
<option value="Retry">Retry</option>
</select>
</form>
And here is my java function in the same file:
<%!String getResponseValue(String responseVal){
System.out.println("this is the responsevalue"+responseVal);
return responseVal;
}%>
Could you please let me know, why I am getting an error like below:
'void' type not allowed here
getResponseValue(out.println("<script>this.ResponseType.value</script>")); //[ /Admin.jsp; Line: 49]
^
1 error
I am adding part of my code here:
<form action="www.yahoo.com" id="hiddenform" name="hiddenform" method="post" onSubmit="<%getResponseValue(out.println("><script>this.ResponseType.value</script>"));%>">
<select name="ResponseType">
<option value="Default">Default</option>
<option value="Sucess">Sucess</option>
<option value="Failure">Failure</option>
<option value="Retry">Retry</option>
</select>
</form>
And here is my java function in the same file:
<%!String getResponseValue(String responseVal){
System.out.println("this is the responsevalue"+responseVal);
return responseVal;
}%>
Could you please let me know, why I am getting an error like below:
'void' type not allowed here
getResponseValue(out.println("<script>this.ResponseType.value</script>")); //[ /Admin.jsp; Line: 49]
^
1 error