转发问题??多谢!

mhbjava 05-08-16

message No action instance for path /add could be created

description The server encountered an internal error (No action instance for path /add could be created) that prevented it from fulfilling this request.

转发为什么找不到呢?谢谢!
<html:form action="add.do">来跳转,action="/add.do"也不对!错误是一样的?

我的struts-config.xml配置为:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<form-beans>
<form-bean name="AddForm" type="mhbjava.itfly.guestbook.form.AddForm">
<form-property name="content" type="java.lang.String" />
<form-property name="homePage" type="java.lang.String" />
<form-property name="userName" type="java.lang.String" />
<form-property name="email" type="java.lang.String" />
<form-property name="oicq" type="java.lang.String" />
<form-property name="face" type="java.lang.String" />
<form-property name="qq" type="java.lang.String" />
<form-property name="tel" type="java.lang.String" />
</form-bean>
</form-beans>

<action-mappings>
<action path="/showlist"
type="mhbjava.itfly.guestbook.action.ShowListAction">
<forward name="loadok" path="/showlist.jsp" />
</action>

<action
path="/add"
type="mhbjava.itfly.guestbook.action.AddAction"
attribute="addForm"
input="/add.jsp"
name="AddForm">
<forward name="addok" path="/index.jsp"/>
</action>
</action-mappings>

</struts-config>

shipenggedit
2005-08-22 16:14

这个action="/add.do"是你的form将要提交的action么?
如果是的话,你的form声明最好用标签<html:form>声明,则不需要指定action属性,struts会自动根据你的标签自己生成action属性。

如果一定这么写的话,需要写成:action="/yourServerContext/add.do".
注意,你的servercontext也要加上,当然不推荐你这么做。