a. new project
b.new WebModule
c.new jsp
d. new ActionForm: input fields,Fields definition,add to Struts-Config.xml
e. new Jsp from ActionForm : Brows to select class named by d.
Update the code : ex.
< html:form name="form1" action="/MyAction.do" type="strutsdemo.myActionForm" method="Post">
add jsp file : action ok or error ok.jsp and error .jsp
f. new Action:
FormBean name: (ActionForm name)
Scope: request
validate FormBean:false
input Jsp : (Jsp from ActionForm name)
g.Complete the Code:
1.get the values of parameter input from Jsp(from ActionForm)
2. String target;
target="ok"; //ok.jsp...
target="error"; //error.jsp...
return actionMapping.findForward(target);
h.Compile and Run Project.
博客介绍了Struts项目的创建与代码实现步骤,包括新建项目、WebModule、jsp、ActionForm等,还说明了从ActionForm创建jsp、新建Action的设置,以及完成代码获取参数值、设置跳转目标,最后编译运行项目。
1314

被折叠的 条评论
为什么被折叠?



