您的位置:首页 > 编程语言 > Java开发

struts2 注解例子

2015-03-24 15:55 267 查看
package com.joeyon.demo.component.action;

import com.joeyon.framework.common.lang.Caster;
import com.joeyon.framework.component.assembly.manager.AssemblyComponentManager;
import com.joeyon.framework.util.CollectionUtils;
import com.joeyon.framework.webutil.annotation.Action;
import com.joeyon.framework.webutil.annotation.Result;
import com.joeyon.demo.component.vo.ComponentVO;
import com.joeyon.demo.framework.webutil.BaseAction;
import java.util.List;

@org.springframework.stereotype.Component("jfs.ComponentAction")
@Action(className="jfs.ComponentAction")
public class ComponentAction extends BaseAction
{
private ComponentModel model = new ComponentModel();

public Object getModel()
{
return this.model;
}
@Action(name="ComponentAction_goMain")
@Result("/demo/pages/com/joeyon/demo/component/ComponentAction_goMain.jsp")
public String goMain() {
List allRegisterComponent = AssemblyComponentManager.getInstance().getAllRegisterComponent();

this.model.setListComponent(CollectionUtils.toList(allRegisterComponent, new Caster()
{
public ComponentVO cast(Object obj)
{
ComponentVO vo = new ComponentVO();
vo.setComponent((com.joeyon.framework.component.Component)obj);
return vo;
}
}));
return "success";
}
@Action
@Result("/demo/pages/com/joeyon/demo/component/ComponentAction_goDisplay.jsp")
public String goDisplay() {
ComponentVO vo = new ComponentVO();
vo.setComponent(AssemblyComponentManager.getInstance().getComponentByCode(this.model.getComponentCode()));

this.model.setComponentVO(vo);
return "success";
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: