<jsp:useBean id="a" class="com.test.sum"/>
<jsp:setProperty property="x" name="a" value="2"/>
<jsp:setProperty property="y" name="a" value="3"/>//get的话是直接在屏幕显示
<jsp:getProperty name="a" property="sum"/>
<jsp:useBean id="a" class="com.test.sum"/>
<%a.setX(2); %>//不带!,带!会报错不知道为什么
<%a.setY(3); %>
<%=a.getSum() %>
<form>
x:<input type="text" name="x"><br>
y:<input type="text" name="y"><br>
<input type="submit" value="ok">
</form>
<jsp:useBean id="a" class="com.test.sum"/>
<jsp:setProperty property="x" name="a" />
<jsp:setProperty property="y" name="a" />
<jsp:getProperty name="a" property="sum"/>
<form>
x:<input type="text" name="x1"><br>
y:<input type="text" name="y1"><br>
<input type="submit" value="ok">
</form>
<jsp:useBean id="a" class="com.test.sum"/>
<jsp:setProperty property="x" name="a" param="x1" />
<jsp:setProperty property="y" name="a" param="y1" />
<jsp:getProperty name="a" property="sum"/>
<form action="output.jsp" id="a1">
姓名:<input type="text" name="name"><br>
性别:<input type="text" name="sex"><br>
出生年月:<input type="text" name="birthday"><br>
民族:<input type="text" name="nation"><br>
<input type="submit" value="ok">
</form>
<jsp:useBean id="a" class="com.test.info" scope="session"/>
<jsp:setProperty property="name" name="a" />
<jsp:setProperty property="birthday" name="a" />
<jsp:setProperty property="sex" name="a" />
<jsp:setProperty property="nation" name="a" />
<%session.setAttribute("a1", a1);%>