日期:2014-05-16  浏览次数:20377 次

js中使用jsp:usebean访问JavaBean
The bean is interpreted by the server (servlet engine). The browser sees
no such thing. View the HTML source to see what the browser sees.
Javascript, as you are using it, runs on the client, well after the
server is done. It cannot call bean methods.

If you want the value of that method in a js variable, assign it at run
time.
var equ = <%= vConf[equNo].getEqu() %>;
If the above method returns a string, put it in quotes.
var equ = "<%= vConf[equNo].getEqu%>";

The above assumes both beans are written properly and their methods
return what is expected. If you aren't sure, ask in
comp.lang.java.programmer

引用
<%@ page language="java" contentType="text/html;charset=UTF-8" isELIgnored="false"
import="java.util.HashMap" pageEncoding="UTF-8"%>
<jsp:useBean id="Arithmetic" class="com.homelink.common.module.util.Arithmetic" scope="page"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>链家地产销售交易管理系统</title>
<script type="text/javascript" src="scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="scripts/EimUtil.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//集成IM
//var employeeSN = "${employeeSN}";
var emp = "admin";
var mi = "<%=Arithmetic.getEncString("admin")%>";
alert("密文是:" + mi);
EimUtil.RunEim("wangrl1");
});

</script>
</head>
<body class="easyui-layout">
</body>
</html>