[其他问题] [解决中]
V1.1.9Beta版本,创建新的action后,访问新的action总是出现404(代码如下)
package org.yidu.novel.action;
import java.util.HashMap;
import java.util.Map;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.yidu.novel.action.base.AbstractPublicListBaseAction;
import org.yidu.novel.action.base.JsonBaseAction;
import org.yidu.novel.bean.ResponseBean;
@ParentPackage("yidu-default")
@Namespace("")
public class TestAction extends JsonBaseAction{
/**
*
*/
private static final long serialVersionUID = -905766621913642666L;
@Override
@Action("/testJson")
protected ResponseBean<?> loadJsonData() {
Map<String,Object> mso=new HashMap<String, Object>();
mso.put("code", "成功");
mso.put("message", "失败");
ResponseBean res=new ResponseBean<Map<String,Object>>();
res.setDataObj(mso);
res.setStatus(200);
return res;
}
}
----------------------------------------------------------下面这个是仿造MobileSearchAction填写还是不行----------------------------
package org.yidu.novel.action;
import java.util.List;
import java.util.Map;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.interceptor.validation.SkipValidation;
import org.yidu.novel.action.AjaxServiceAction.ReturnCode;
import org.yidu.novel.action.base.AbstractPublicBaseAction;
import org.yidu.novel.constant.YiDuConstants;
import org.yidu.novel.dto.JsonInfoDTO;
import org.yidu.novel.entity.TChapterOrder;
import org.yidu.novel.entity.TChargeOrder;
import org.yidu.novel.entity.TOrder;
import org.yidu.novel.entity.TUser;
import org.yidu.novel.utils.LoginManager;
/**
*
* <p>
* 检查用户登录状态
* </p>
* Copyright(c) 2014 YiDu-Novel. All rights reserved.
*
* @version 1.1.9
* @author shinpa.you
*/
@Action(value = "testcheck")
public class TestAction extends AbstractPublicBaseAction {
/**
* 串行化版本统一标识符
*/
private static final long serialVersionUID = -5991997032217966675L;
/**
* 功能名称。
*/
public static final String NAME = "testcheck";
/**
* 小说编号
*/
private int chapterno;
/**
* JSON数据的DTO
*/
private JsonInfoDTO dto = new JsonInfoDTO();
public int getChapterno() {
return chapterno;
}
public void setChapterno(int chapterno) {
this.chapterno = chapterno;
}
public JsonInfoDTO getData() {
return dto;
}
/**
* URL。
*/
public static final String URL = NAMESPACE + "/" + NAME;
@SkipValidation
@Override
public String execute() {
dto.setCode(ReturnCode.SUCCESS);
dto.setResult("222222222222222");
System.out.println("11111111111111111111-----------------");
return JSON_RESULT;
}
@Override
public void loadData() {
}
@Override
public int getPageType() {
return YiDuConstants.Pagetype.PAGE_OTHERS;
}
@Override
public String getTempName() {
// TODO Auto-generated method stub
return null;
}
}