zoukankan      html  css  js  c++  java
  • jsp页面执行java语法,获取的值在页面调用

    1. 首先在页面头引用用到类的包路径
    2. 写需要执行的java语法
    3. 页面转换引用
    <!-- 引用包路径 -->
    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%@ page language="java" import="com.inspur.icpmg.systemMg.vo.UserEntity"%>
    <%@ page language="java" import="com.inspur.icpmg.itss.asset.service.AssetService"%>
    <%@ page language="java" import="com.inspur.icpmg.itss.asset.service.AssetServiceImp"%>
    <%@ page language="java" import="com.inspur.icpmg.util.WebLevelUtil" %>
    <%@ page language="java" import="com.inspur.icpmg.itss.asset.service.AssetInventoryServiceImp" %>
    
    <!-- 执行java语法 -->
    <%
        UserEntity user = WebLevelUtil.getUser(request);
    	String online = user.getUname();
        AssetInventoryServiceImp service =  new AssetInventoryServiceImp();
        String cloudcenterid = service.getcloudcenterIdByCityid(user.getCityid());
    %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <jsp:include page="/web/inc.jsp"></jsp:include>
    <title>xxxx</title>
    </head>
    
    <body>
    
    <!-- 转换 -->
    <script>
        $(document).ready(function() {
    	    cloudcenterid = '<%=cloudcenterid%>';
    	    onlineUser = '<%=online%>';
        });
    
        <!-- 使用 -->
        $('#onlineUser').val(onlineUser);
    </script>
    
    
    <input type="text" id="onlineUser"/> 
  • 相关阅读:
    ASP.NET DropDownList 控件绑定数据
    Linux图形界面与命令行界面切换
    Linux性能分析
    UTF虚拟对象
    UFT场景恢复
    UFT参数化
    UFT检查点
    UFT三种录制方式
    UFT基本操作
    UFT安装目录简单介绍
  • 原文地址:https://www.cnblogs.com/wjup/p/10576083.html
Copyright © 2011-2022 走看看