I know some tricky about this problem
the struts convention will scan action class in the specific package
for example:
struts.convention.package.locators indicate the action class suffix

but when you jar the classes,I suppose that struts2 can't scan the action
class
in jar files,if this is true,I will always deploy war with class files
exploded,I want to find
a workaround,thanks

On Fri, Sep 30, 2011 at 10:22 AM, dan.zheng <cmaj...@gmail.com> wrote:

> I jar the classes and put it into WEB-INF/lib
> of course you know,the war will package all jars and jsp files in bundle
> why the struts2 can't scan classes in WEB-INF/lib?
>
>
> On Fri, Sep 30, 2011 at 10:05 AM, Steven Yang <kenshin...@gmail.com>wrote:
>
>> sorry just to be clear
>> did you "jar" the classes or did you "war" the classes?
>>
>> if you "jar" the classes then i dont think struts 2 will scan your classes
>> in jars.
>>
>> On Thu, Sep 29, 2011 at 2:34 PM, dan.zheng <cmaj...@gmail.com> wrote:
>>
>> > hi,everyone
>> >  I meet an odd problem with struts2 annotation,Let me elaborate it first
>> >
>> > import java.util.List;
>> >
>> > import lombok.Getter;
>> > import lombok.Setter;
>> >
>> > import org.apache.commons.lang.StringUtils;
>> > import org.apache.struts2.ServletActionContext;
>> > import org.apache.struts2.convention.annotation.Action;
>> > import org.apache.struts2.convention.annotation.Result;
>> > import org.apache.struts2.convention.annotation.Results;
>> > import org.apache.struts2.interceptor.validation.SkipValidation;
>> > import org.springframework.beans.factory.annotation.Autowired;
>> >
>> > import com.dbappsecurity.portal.model.PortalUser;
>> > import com.dbappsecurity.portal.service.PortalUserService;
>> > import com.opensymphony.xwork2.ActionSupport;
>> >
>> > @Results({
>> >    @Result(name="input",location="main.jsp"),
>> >    @Result(name="list",location="list.jsp")
>> > })
>> > public class MainAction extends ActionSupport {
>> >    @Getter @Setter private PortalUser user;
>> >    @Autowired
>> >    private PortalUserService portalUserService;
>> >    public String execute() throws Exception {
>> >        return INPUT;
>> >    }
>> >    @Action("addUser")
>> >    public String addUser() throws Exception {
>> >        portalUserService.addUser(user);
>> >        return listUser();
>> >    }
>> >    @Action("listUser")
>> >    @SkipValidation
>> >    public String listUser() throws Exception {
>> >        List theUserList = portalUserService.getPortalUserList(null);
>> >
>> >  ServletActionContext.getRequest().setAttribute("userList",theUserList);
>> >        return "list";
>> >    }
>> >    @Action("modifyUser")
>> >    public String modifyUser() throws Exception {
>> >        List theUserList = portalUserService.getPortalUserList(null);
>> >
>> >  ServletActionContext.getRequest().setAttribute("userList",theUserList);
>> >        return "list";
>> >    }
>> >
>> > this is the struts2 action class, I configure it correctly and type the
>> url
>> > http://domain/listUser   it will list all users
>> > http://domain/modifyUser it can modify the users
>> > all things go well in tomcat with exploded class files
>> >
>> > but when I build with the war file and deploy it into tomcat webapp
>> folder,
>> > the page report
>> > there is no action name listUser
>> > the difference between the two scenario is exploded class files and
>> > archived
>> > class files that I compile and jar the action and other class files into
>> > it.
>> > I was puzzled about this phenomenon
>> >
>> > so any suggestions and advices will be very appreciated!
>> >
>>
>
>

Reply via email to