Skip to content

Instantly share code, notes, and snippets.

@A-pZ
Created September 29, 2014 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save A-pZ/1a3dccaec467c07d0a50 to your computer and use it in GitHub Desktop.
Save A-pZ/1a3dccaec467c07d0a50 to your computer and use it in GitHub Desktop.
現在のActionクラスの例(Struts2+Spring3+Lombok)
/**
*
*/
package lumi.action.sample;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import lumi.action.LumiActionSupport;
import lumi.service.SampleService;
import lumi.vo.sample.SampleVO;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.interceptor.annotations.Blocked;
import com.opensymphony.xwork2.validator.annotations.Validations;
import com.opensymphony.xwork2.validator.annotations.VisitorFieldValidator;
/**
* @author A-pZ
*
*/
@Namespace("/")
@ParentPackage("lumi-default")
@Results({
@Result(name = ActionSupport.SUCCESS, location = "form" , type="thymeleaf"),
@Result(name = ActionSupport.INPUT, location = "form" , type="thymeleaf"),
})
@Controller
@Scope("prototype")
@Validations(
visitorFields = {
@VisitorFieldValidator(fieldName="vo" , appendPrefix=true)
}
)
@Slf4j
public class SampleSubscribeAction extends LumiActionSupport {
@Action("subscribe")
public String subscribe() throws Exception {
log.info("subscribe");
log.info("value object:" + vo);
service.storeTest(vo);
return SUCCESS;
}
@Getter @Setter
private SampleVO vo;
@Blocked
@Autowired
@Getter @Setter
private SampleService service;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment