Scope of jsp:useBean

后端 未结 3 1685
小鲜肉
小鲜肉 2021-02-06 19:56

home.jsp



<%
      username=\"Jitendra\";
%>



        
3条回答
  •  失恋的感觉
    2021-02-06 20:22

    Your code is "evil" because a java.lang.String is not really a bean. Significantly, it doesn't have a "set" method to change its text (that's intentional, it's meant to be immutable).

    The way you access beans is to declare one, and then use its properties (i.e. the names behind the get() and set() methods) to change it. You cannot directly change the actual bean instance, only its values.

提交回复
热议问题