2013年9月16日星期一

Consulting several struts2 (eclipse) the primary issue

1, struts2 struts.xml configuration files should be placed in what position ?

is placed under the src directory javaresource

Or the classes under WEB-INF .

2,
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>
 <package name="dzr" namespace="/test" extends="struts-default">
 
  <action name="helloworld" class="cn.dzr.action.HelloWorldAction" method="execute">
  <result name="success">/WEB-INF/page/hello.jsp</result>
  </action>
 
  <action name="addUI">
  <result>/WEB-INF/page/employeradd.jsp</result>
  </action>
    </package>
</struts>


this code, when I visited addUI ,
http://localhost:8080/Struts2/addUI
http://localhost:8080/Struts2/test/addUI
to above two paths , browsers were prompted following errors:

type Status report

message There is no Action mapped for namespace [/] and action name [addUI] associated with context path [/ Struts2].

description The requested resource is not available.
This is Why ?



------ Solution ------------------------------------ --------
on the resource under the src directory , the compiler automatically placed in classes under eclipse .

For can visit:
First, your project name is Struts2?
Normally certainly : http://localhost: port / project name / namespace / action
namely : http://localhost:8080/Struts2/test/addUI ( If your project name is Struts2)
If you can not access , delete cache files , restart .
try again, you can not continue to ask .

没有评论:

发表评论