可以的,像在html中嵌入java一样
function doChgCustCallTime(cust_id,value)
{
<% if(!g_bWorkEnded) { %>
prodObj = window.event.srcElement; var tblContent = document.getElementById("tblContent");
var len = tblContent.rows.length;
if(typeof(len)=="undefined") return;
if(cust_id == "") return;
url = "/zhnt/jsp/co/co/telcall/chgCustCallTime.jsp?CUST_ID=" + cust_id;
url = url + "&NEW_CALL_TIME="+value;
var f = document.getElementById("dataCallTimeFrame");
f.src = url;
prodObj = null;
<% } else { %>
alert("·ÃÏúÔ±¹¤×÷ÒѾ­½áÊø£¬²»ÄÜÔÙÐÞ¸ÄԤԼʱ¼ä!");
document.forms[0].reset();
return;
<% } %>
}
function doChgCustCallTime(cust_id,value)
{
<% if(!g_bWorkEnded) { %>
prodObj = window.event.srcElement; var tblContent = document.getElementById("tblContent");
var len = tblContent.rows.length;
if(typeof(len)=="undefined") return;
if(cust_id == "") return;
url = "/zhnt/jsp/co/co/telcall/chgCustCallTime.jsp?CUST_ID=" + cust_id;
url = url + "&NEW_CALL_TIME="+value;
var f = document.getElementById("dataCallTimeFrame");
f.src = url;
prodObj = null;
<% } else { %>
alert("·ÃÏúÔ±¹¤×÷ÒѾ­½áÊø£¬²»ÄÜÔÙÐÞ¸ÄԤԼʱ¼ä!");
document.forms[0].reset();
return;
<% } %>
}
如果你能从JAVABEAN返回数据的话。
<script language="javascript">
var aa=<%=bb%>;
</script>
bb就是从javabean返回的值。
<script language="JavaScript">
function test(){
document.form1.test.value="Y";
document.form1.submit();
}
</script>
</head><body>
<form action="" method="post" name="form1">
<a href="javascript:test();">Click</a>
<input type="hidden" name="test" value="">
<%
String test=(request.getParameter("test")!=null?request.getParameter("test"):"");
if(test.equals("Y")){
out.println("在这里调用你的bean,这样你应该清楚了吧!Best Wish!");
}
%>
</form>
如果静态javascript调用bean的话,我只知道用xml转化一下就可以。
import="my.MailBean,my.MyConstants"
%>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<script language="JavaScript">
function test(){
document.form1.test.value="Y";
document.form1.submit();
}
</script>
</head>
<body>
<form action="" method="post" name="form1">
<a href="javascript:test();">Click</a>
<input type="hidden" name="test" value="">
<%
String test=(request.getParameter("test")!=null?request.getParameter("test"):"");
if(test.equals("Y")){
out.println("here run your bean!Best Wish!");
MailBean add = new MailBean();
String wo = add.getMailAttachment();
out.println(wo);
}
%>
</form></body>
test是你创建的一个javabean的对象<script language="javascript">
var a = <%=test.getName()%>;
var b = <%=test.name%>
</script>
这样,javascript的变量a就可获得test对象的方法getName返回的值
b可获得test的成员变量name的值