问答详情
源自:5-8 JavaBean四个作用域范围

为什么一直出现Duplicate local variable user。。。。视频中用的不也都是同一个myUser命名么

<%@ page language="java" contentType="text/html; charset=utf-8"

    pageEncoding="utf-8"%>


<!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">

<title>Insert title here</title>

</head>

<body>

<jsp:useBean id="user" class = "com.imooc.www.Users"></jsp:useBean>

<h1>测试javaBean作用域范围</h1>

<hr>


<jsp:useBean id="user" class="com.imooc.www.Users"  scope="application"/>

<jsp:getProperty property="username" name="user"/>

<jsp:getProperty property="username" name="user"/>

</body>

</html>

56c93bbc00015e1605000332.jpg

56c93bbc00012fc605000340.jpg

56c93bbd000100bd05000357.jpg


提问者:菠萝1230 2016-02-21 12:23

个回答

  • 菠萝1230
    2016-02-21 12:29:42

    写重复l