我在两个动作类(MemberAction,AccountOverviewAction)中有logonForm对象。我想在这两个动作类中将logonForm作为struts2中的会话范围变量。但是当打开这个视图页面时,它会抛出异常。有什么我遗失的吗?另一方面,我没有找到关于对象作为会话范围示例的struts2 web项目。我没有在http中提及会话。如果你知道例子,你能给我一个网址吗?
Unable to instantiate Action, memberAction, defined for 'membersite' in
namespace
'/secure'com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException
: No mapping found for dependency [type=com.awip.struts.actionform.LogonForm,
name='session'] in private com.awip.struts.actionform.LogonForm
com.awip.struts.action.MemberAction.logonForm. - action -
LogonForm Bean
@Repository
@Scope("session")
public class LogonForm extends ActionSupport {
行动类
public class MemberAction extends ActionSupport implements ServletRequestAware{
@Inject("session")
private LogonForm logonForm;
2动作类
public class AccountOveriewAction extends ActionSupport implements ServletRequestAware{
@Inject("session")
private LogonForm logonForm;
的applicationContext.xml
<bean id="logonForm" class="com.awip.struts.actionform.LogonForm" scope="session"/> // it seems useless of this line ???
<bean id="memberAction" class="com.awip.struts.action.MembersiteAction" />
struts.xml中
<action name="membersite" method="displayMembersiteMain" class="memberAction">
<result name="displayMembersiteMain" type="tiles">.membersite.Main</result>