使用 MYECLIPSE进行开发,发现一个问题..我在MYECLIPSE中新建一个:Struts 1.1 form,action &jsp上面是MYECLIPSE标准的新建命令..
但现在问题是:我用上面的东东创建了一个ACTIONFORM JSP ACTION了..我又在JSP文件中手写加了. <html:form action="/ageschool">
age : <html:text property="age" />
<html:errors property="age" />
<br />
school : <html:text property="school" />
<html:errors property="school" />
<br />
<html:submit />
<html:cancel />
</html:form>
第二个表单,,那么下一步我不知道怎么创建一个ACTIONFORM来接收这个HTML:FORM的数据,及怎么创建一个ACTION来进行逻辑的处理...感谢..
但现在问题是:我用上面的东东创建了一个ACTIONFORM JSP ACTION了..我又在JSP文件中手写加了. <html:form action="/ageschool">
age : <html:text property="age" />
<html:errors property="age" />
<br />
school : <html:text property="school" />
<html:errors property="school" />
<br />
<html:submit />
<html:cancel />
</html:form>
第二个表单,,那么下一步我不知道怎么创建一个ACTIONFORM来接收这个HTML:FORM的数据,及怎么创建一个ACTION来进行逻辑的处理...感谢..
HttpServletRequest request, HttpServletResponse response) {
AgeschoolForm ageschoolForm = (AgeschoolForm) form;// TODO HttpSession session = request.getSession();
session.setAttribute("age", ageschoolForm.getAge());
session.setAttribute("school", ageschoolForm.getSchool()); return mapping.findForward("showageschool");
}
}我在JSP中使用什么STRUTS标签显示SESSION中的内容,感谢
<bean:write name="school"/>
我一个session.setAttribute("age", ageschoolForm.getAge());也没有把BEAN装进去啊,就是一个KEY-VALUE啊怎么成BEAN了呢?>
session.setAttribute("school", ageschoolForm.getSchool());放了二个值,但也不是BEAN啊,为什么bean:write用这个?
如果age不是一个基本对象的话,那么就应该写为<bean:write name="age" property="***"/>,这样的意思就是说要输出name叫age的对象的property(属性)为***的值!
attribute="ageschoolForm"
input="/index.jsp"
name="ageschoolForm"
path="/ageschool"
scope="session"
type="com.yourcompany.struts.action.AgeschoolAction">
<forward name="showageschool" path="/showageschool.jsp" />
</action>public class AgeschoolAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
AgeschoolForm ageschoolForm = (AgeschoolForm) form;// TODO HttpSession session = request.getSession();
session.setAttribute("age", ageschoolForm.getAge());
session.setAttribute("school", ageschoolForm.getSchool());
System.out.println("adsfasdfasdfasdfasdf");
return mapping.findForward("showageschool");
}
}
<body>
ghyghost:
<bean:write name="age" /><br>
<bean:write name="school" />
</body>
不显示为什么?
prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html"
prefix="html"%>没有加标签,,我哭