讲解三大框架如果编程的知识。
6. struts中怎么配置form-bean、action、tiles 此处配置的是struts1.2的
form-bean配置:(在配置文件struts-config.xml中): <form-beans >
<form-bean name="" type=""></form-bean> </form-beans>
name: 指定form的名字; type指定form的类型:包名+类名; action配置:(在配置文件struts-config.xml中) <action-mappings >
<action path="" attribute="" input="" name="" parameter="" scope="request" type="" ></action>
</action-mappings>
path:请求Action的名字; attribute:form的名字,与form-bean中的name对应; input:输入页的路径;
name:如果配置了attribute,name不起作用,与attribute一样; parameter:使用分发Action时,指定调用分发Action中的方法名;
scope:Action的范围; type:Action的类型:包名+类名;
tites配置:
1. 新建一个 tiles-defs.xml文件,并在其中做如下配置: <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN" "/struts/dtds/tiles-config_1_1.dtd"> <tiles-definitions>
<definition name="member-definition" path="/Jsp/layout.jsp"> <put name="top" value="/mTop.do"/> <put name="left" value="/mLeft.do"/>
<put name="main" value="/defaultMmain.do"/> </definition> </tiles-definitions>
2. 在web.xml和struts-config.xml和web.xml中做相应配置: 在struts-config.xml中配置如下: ************
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"/> <set-property property="definitions-parser-validate" value="true"/> </plug-in> ************