问题描述
没事写个发帖的bbs,结果一连串的错误,纠结加郁闷啊;求指点...我贴出我的一部分代码:JSP代码:<form action="Forum!insert.action" method="post" >ForumAction代码:public class ForumAction extends ActionSupport{private static final long serialVersionUID = -1512730658595600926L;private Bbs b;private List<Bbs> bbs ;private String name;//发表文章的人private String title;private String content;private String text;//发表文章public String insert() throws Exception {BbsDao bbsdao = new BbsDao();bbsdao.save(name,title,content);text = "bbs发表成功";return "insert";}set,get 省略...struts.xml代码:<package name="bbs" extends="struts-default"> <!-- 发表文章 --> <action name="insert" class="huan.action.ForumAction" method="insert"> <result name="insert">/message.jsp</result></action> </package> message.jsp代码:<body>${text}</body>报的错误是[/u][/b]:[[/i]http-8080-2] WARN [org.apache.struts2.dispatcher.Dispatcher] - Could not find action or resultThere is no Action mapped for namespace / and action name Forum. - [unknown location]网上找了好多解决办法都不行??? 问题补充:恩,可以了谢谢,顺便问一下<action name="Forum"的name是什么意思?suziwen 写道
解决方案
就是代表你那个url要提交的action名称
解决方案二:
改成这样<action name="Forum" class="huan.action.ForumAction" method="insert"> <result name="insert">/message.jsp</result> </action>