主题 : 用spring mvc写了个方法,不能访问,要在jeecms-servlet-admin-action.xml中注册才能访问,在别的xml文件中一直报找不到,求解
级别: 童生
UID: 73410
积分:21 加为好友
威望: 1 精华: 0
主题:2 回复:12
注册时间:2015-03-30
在线时长:0
1#   发表于:2015-04-08 15:52:25  IP:121.47.*.*
package com.jeecms.client.web;

import java.util.List;
import java.util.Map;


import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.jeecms.client.service.NewsService;

@Controller
@RequestMapping("/news")
public class NewsController {

/**
 * 获取新闻列表接口
 * @param newstype
 * @param startid
 * @param offset
 * @return    fufan
 */
@RequestMapping(value = "/getNewslist")
@SuppressWarnings("rawtypes")
public String getNews(/*@RequestParam("newstype") int newstype,
@RequestParam("startid") int startid,@RequestParam("offset") int offset*/){
JSONObject obj = new JSONObject();
JSONArray jsonArray = new JSONArray();
try{
List list = newsService.getNews(0, 0, 100);
for(int i = 0; i < list.size(); i++){
JSONObject jsonObject = new JSONObject();
Object [] object =  (Object[]) list.get(i);
jsonObject.put("id", object[0] == null ? "" :object[0].toString());
jsonObject.put("title", object[1] == null ? "" :object[1].toString());
jsonObject.put("summary", object[2] == null ? "" :object[2].toString());
jsonObject.put("picurl", object[5]== null ? "" :object[5].toString());
jsonObject.put("ptime", object[6] == null ? "" :object[6].toString());
jsonObject.put("commentNum", object[8] == null  ? "" :object[6].toString());
jsonArray.put(jsonObject);
}

}catch(Exception e){
try {
obj.put("status", -1);
} catch (JSONException e1) {
e1.printStackTrace();
}
e.printStackTrace();
}
try {
obj.put("status", 1);
obj.put("newsList", jsonArray);
} catch (JSONException e) {
e.printStackTrace();
}
return obj.toString();
}

@Autowired
private NewsService newsService;
}
级别: 版主
UID: 70293
积分:78391 加为好友
威望: 1 精华: 0
主题:7 回复:68397
注册时间:2014-12-03
在线时长:0
2#   发表于:2015-04-08 15:53:03  IP:111.76.*.*
二次开发的内容请自己研究
1
级别: 版主
UID: 70293
积分:78391 加为好友
威望: 1 精华: 0
主题:7 回复:68397
注册时间:2014-12-03
在线时长:0
3#   发表于:2015-04-08 15:53:09  IP:111.76.*.*
二次开发的内容请自己研究
1
级别: 商业授权用户
UID: 59821
积分:354 加为好友
威望: 4 精华: 0
主题:37 回复:222
注册时间:2014-03-28
在线时长:0
4#   发表于:2015-04-08 16:04:20  IP:121.45.*.*
我去,不能给点提示么
级别: 版主
UID: 70293
积分:78391 加为好友
威望: 1 精华: 0
主题:7 回复:68397
注册时间:2014-12-03
在线时长:0
5#   发表于:2015-04-08 16:05:16  IP:111.76.*.*
二次开发的内容不在服务范围内,如果需要添加功能,可以联系售前人员进行定制
1
级别: 商业授权用户
UID: 59821
积分:354 加为好友
威望: 4 精华: 0
主题:37 回复:222
注册时间:2014-03-28
在线时长:0
6#   发表于:2015-04-08 16:05:34  IP:121.45.*.*
回复第3楼    能 给点提示吗
级别: 版主
UID: 70293
积分:78391 加为好友
威望: 1 精华: 0
主题:7 回复:68397
注册时间:2014-12-03
在线时长:0
7#   发表于:2015-04-08 16:08:58  IP:111.76.*.*
配置文件都是有分类的,标签对应的方法,前台,后台用的类,数据库配置信息等都是严格分开的,当然不能乱改配置文件
1
级别: 商业授权用户
UID: 59821
积分:354 加为好友
威望: 4 精华: 0
主题:37 回复:222
注册时间:2014-03-28
在线时长:0
8#   发表于:2015-04-08 16:13:16  IP:121.45.*.*
回复第7楼 没有改配置,我现在是要写一个http 接口与手机端交互,我想了解下,这系统是不是限制的请求,如需要.do 、.htm 等等开头的才能访问吗
级别: 版主
UID: 70293
积分:78391 加为好友
威望: 1 精华: 0
主题:7 回复:68397
注册时间:2014-12-03
在线时长:0
9#   发表于:2015-04-08 16:15:29  IP:111.76.*.*
这个是action里面定义的
1
1 共1页