一 A:使用struts,在Action中能否向jsp页的java变量传值?
如:
test.jsp
<%
String test = new String();
%>
testAction:
String aa = "123";
如何将aa的值传到test.jsp中,赋于test??
Q:在action中,
String aa = "123";
request.setAttribute("test", aa);
然后到jsp上:
<%
String test = (String)request.getAttribute("test");
%>
二用ActionForm(自动存值)
在Action中直接取值
ComputerActionForm computerActionForm = (ComputerActionForm) form;
Integer op1=computerActionForm.getOp1();
Integer op2=computerActionForm.getOp2();