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>