2

ここに私のstruts.xmlファイルがあります

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

<constant name="struts.devMode" value="true" /> 
<constant name="struts.enable.DynamicMethodInvocation" value="true"/>
<constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" />  

<package name="Authentiate" extends="struts-default">

<global-results>

<result name="error">/error.jsp</result>

</global-results>

<action name="loginAuthenticate*" class="com.authenticate.actions.LoginAuthenticate" method="{1}">

<result name="success">/welcome.jsp</result>
<result name="error">/error.jsp</result>
<result name="redirectRegister" type="redirect">/registration.jsp</result>

</action>

</package>

ベロシティ テンプレートを使用していませんが、次のエラーが表示されます。

java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=org.apache.struts2.views.velocity.VelocityManager, name='default'] in public void org.apache.struts2.osgi.OsgiConfigurationProvider.setVelocityManager(org.apache.struts2.views.velocity.VelocityManager). - Class: com.opensymphony.xwork2.inject.ContainerBuilder
4

2 に答える 2

0

まず最初に、デフォルトの型を使用して結果の型を明示的に指定してみてくださいdispatcher:

<result name="success" type="dispatcher">/welcome.jsp</result>
<result name="error" type="dispatcher">/error.jsp</result>
<result name="redirectRegister" type="redirect">/registration.jsp</result>

これで解決しない場合は、解決できないいくつかの Struts 依存関係があるようです。apache's bugtracker のこのバグによると、次のようにVelocityManagerBean を追加する必要がありますstruts.xml

<bean class="org.apache.struts2.views.velocity.VelocityManager" name="default" optional="true" />
于 2013-04-30T06:49:03.760 に答える