1、action="hellowordaction.do" 应该是"/hellowordaction.do"吧,但是LZ你没有帖上来Struts-config.xml的配置,我也不知道你怎么写的。
2、whosayhelloword.jsp 中"<input type="text" name="username"> "写成"<html:text name="hellowordactionform" property="username"/>" 当然其中的name对应的是actionForm
3、hellowordaction.java 中你用的是request.getAttribute("");获得username是不行的,你没有setAttribute过呀,不过话说回来,就你这个Demo的话。
用request.getAttribute是体现不出你actioForm的作用的。还有点就是,LZ你的命名规范是在是.....
你用的是Eclipse吗?
2、whosayhelloword.jsp 中"<input type="text" name="username"> "写成"<html:text name="hellowordactionform" property="username"/>" 当然其中的name对应的是actionForm
3、hellowordaction.java 中你用的是request.getAttribute("");获得username是不行的,你没有setAttribute过呀,不过话说回来,就你这个Demo的话。
用request.getAttribute是体现不出你actioForm的作用的。还有点就是,LZ你的命名规范是在是.....
你用的是Eclipse吗?
根据你报的错,应该是web.xml和struts-config.xml中配置有遗漏或错误。
web.xml似乎没错
你的/WEB-INF/struts-config.xml这个配置文件呢?
改成
action="/hellowordaction.do"> <init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
<?xml version="1.0" encoding="text/html;charset=gb2312"?>
<struts-config>
<form-beans>
<form-bean name="hellowordactionform" type="struts.sample.cap1.sample2.form.hellowordactionform"/>
</form-beans>
<action-mappings>
<action name="hellowordactionform"
type="yan.hellowordaction"
scope="request"
path="/hellowordaction"
validate="false">
<forward name="success" path="sayhelloword.jsp"/>
</action>
</action-mappings>
</struts-config> 这个忘记贴出来了!
我没用开发工具,用的记事本。
改action="/hellowordactionform.do"还是不能解决问题!
还是报404错误!直接报:/hellowordactionform.do is not avaiable
2、whosayhelloword.jsp 中" <input type="text" name="username"> "写成" <html:text name="hellowordactionform" property="username"/> " 当然其中的name对应的是actionForm
3、hellowordaction.java 中你用的是request.getAttribute("");获得username是不行的,你没有setAttribute过呀,不过话说回来,就你这个Demo的话。
用request.getAttribute是体现不出你actioForm的作用的。
其他的和rorey_008说的第3点一样