使用struts2开发中,在jsp页面的js中用EL表达式取得action中传过来的值。
Action代码如下:
public class FrameLayoutAction extends BaseAction{
private static final long serialVersionUID = -2065227327273288067L;
private String loginUserName;
private String employeeSN;
public string login(){
loginUserName = "wangruiling";
employeeSN="20003101";
}
public String getEmployeeSN() {
return employeeSN;
}
public void setEmployeeSN(String employeeSN) {
this.employeeSN = employeeSN;
}
public String getLoginUserName() {
return loginUserName;
}
public void setLoginUserName(String loginUserName) {
this.loginUserName = loginUserName;
}
}
在jsp中的js中获得employeeSN和loginUserName的值,实现代码如下:
<%@ page language="java" contentType="text/html;charset=UTF-8" isELIgnored="false"
import="java.util.HashMap" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!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.4.2/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="scripts/EimUtil.js"></script>
<%@ include file="/common/colorbox.jsp"%>
<script type="text/javascript">
$(document).ready(function(){
//集成IM
var employeeSN = "${employeeSN}";
EimUtil.RunEim(employeeSN);
});
</script>
</head>
<body class="easyui-layout">
<div class="loginbar">
<div class="loginBox">
<div class="loginName">${loginUserName}</div>
</div>
</div>
</body>
</html>
分享到:
相关推荐
Struts2资源文件在jsp页面中显示乱码解决
很好的页面 希望大家下载
jsp通过Ajax无刷新获取Action返回的模拟数据,然后通过struts2转化成json数据返回页面....这里面Map,List,对象等等,一些常用的操作都有。主要的代码在Action和 json.js里面。适合新手入门
Java struts2 ongl 标签的详细在jsp页面的介绍
例如,在 Action 中定义了 `User` 对象,可以在 JSP 页面中使用 `user2!add?user.userName=MGC` 的方式将参数传递给 Action。 使用 ModelDriven 接收参数 ModelDriven 是 Struts2 中的一种模型驱动接口,可以用来...
采用struts2框架实现简单的增删改查员工信息操作,可反复进行操作。
Struts2页面开发中常用的标签介绍,介绍的比较详细。适合开发时候的查询
功能: 在登录页面login.jsp中输入用户名...2. 项目添加Struts2类包支持 3. 设置核心控制器(配置web.xml) 4. 创建业务逻辑控制器(Action) 5. 创建视图页面 6. 创建struts.xml配置Action 7. 部署和运行struts2项目
JSP+Struts2开发当当购书网源代码下载
struts2+JSP +mysql 制作简单的界面
struts2中action如何获取jsp页面参数1.rar
struts2中action如何获取jsp页面参数1.pdf
struts2 中action 如何获取jsp 页面参数1.pdf
利用Struts 2标签创建ex3.jsp页面,此页面提交给tag.action,在structs.xml中配置这个action的转发视图为result.jsp在result.jsp页面中显示ex3.jsp页面控件的值。(源代码和实验报告)
struts2开发需要用到的jar包
struts2的概述struts2下的HelloWord struts2基础 struts2做好准备 struts2的标志 struts2的Action讲解 struts2中的国际化 struts2转化器 struts2实现表单数据校验 struts2的基石-拦截器 struts2中实现IOC struts2中...
具体要求是在loginAction类中分别用login()和registered()处理用户登录和注册的过程,分别创建login.jsp和register.jsp两个页面实现登录和注册的输入,这两个页面提交给loginAction中的两个方法进行业务处理,...