jsp中输出的两种方法

1.定义局部变量

<body>

<%

int flag=new Random().nextInt(100);

String str=" ";

if(falg<=30){

str="中奖了";

}

%>

<%=str

%>

</body>

2.限定输出范围的内容

<body>

<%

int flag=new Random().nextInt(100);

if(falg<=30){

str="中奖了";

<%}else{%>

再试试

<%}%>

</body>


版权声明:本文为weixin_46278059原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。