简体   繁体   English

在同一jsp中的2个脚本之间传递java变量

[英]passing java variable between 2 scripts in the same jsp

I have this jsp: 我有这个jsp:

<% 
String mystr = "";
some java code %>
<div> ... <div>
<% some java code
  mystr += "something";
 %>

how can I pass mystr to the second script without having a compilation exception? 如何在没有编译异常的情况下将mystr传递给第二个脚本?

您可以在jsp页面中声明该字符串。

 <%! String mystr = ""; %>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM