I am working on Java Web Application which actually is a coding competition platform. Focussing upon only two modules, code.jsp
and Compile.java
.
In JSP, there is a button(compile/submit) and an option pane (for language selection e.g. C or C++). Now I am creating an object of Compile Class and i have to pass language chosen from option pane and button choosen as its method's parameter. So how can i get values of both elements and pass them to java method.
This is for Windows server, and I am using Apache 8.5 with Oracle 12c as database
function compile()
{
var sel=document.getElementById("slct");
var lang=sel.options[sel.selectedIndex].text;
var cd=document.getElementById("cd");
var code=cd.value;
var button=document.getElementByName("sbt");
var btn=button.value;
<%
Compile c=new Compile(questag,pool,lang,clg,code,btn);
b=c.compi();
System.out.println(b.getExpOut());
%>
}
Expected is : those variables lang,code,btn can be passed in the java method. Error is : they are JS variables and cant be passed like this.