Hello All
I have a small code in
JSP as following :
<%@ page language='
java'%>
<%@ page import='java.*'%>
<%
Java_module obj = new Java_module();
%>
<body bgcolor="lightblue">
<form name="form1">
<input type="text" name="text1" size="100">
<input type="submit" name="enter" value="Click" onlick="return(callme())">
</form>
</body>
<script language="javascript">
function callme()
{
<%
String s_result=obj.disp();%>
document.form.text1.value= <%= s_result%>
return false;
}
</script>
and the Java_module is as follows
public class Java_module
{
public String disp()
{
String str="JAVARANCH";
return str;
}
}
In general what would be the way to retrieve a string from a java method and display it in a textbox of a form in a JSP file