主题 : 报错,怎么解决
级别: 商业授权用户
UID: 59821
积分:354 加为好友
威望: 4 精华: 0
主题:37 回复:222
注册时间:2014-03-28
在线时长:0
1#   发表于:2015-04-08 17:24:03  IP:121.45.*.*
javax.servlet.ServletException: Could not resolve view with name {"newsList":[{"commentNum":"2013-09-27","summary":"","id":"572","title":"瑞信轮证:腾讯十天线争持 A股假前续软","picurl":"","ptime":"2013-09-27"},{"commentNum":"2013-09-27","summary":"","id":"571","title":"李嘉诚李兆基变身淡友 业  ....          n servlet with name 'JeeCmsAdmin'
级别: 版主
UID: 70293
积分:78391 加为好友
威望: 1 精华: 0
主题:7 回复:68397
注册时间:2014-12-03
在线时长:0
2#   发表于:2015-04-08 17:24:42  IP:111.76.*.*
你操作什么报了错
1
级别: 商业授权用户
UID: 59821
积分:354 加为好友
威望: 4 精华: 0
主题:37 回复:222
注册时间:2014-03-28
在线时长:0
3#   发表于:2015-04-08 17:26:33  IP:121.47.*.*
回复第2楼package com.jeecms.client.web;

import java.util.List;


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 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;
}

在 jeecms-servlet-admin-action.xml    加入了

<bean id="newsController" class="com.jeecms.client.web.NewsController" />
级别: 版主
UID: 70293
积分:78391 加为好友
威望: 1 精华: 0
主题:7 回复:68397
注册时间:2014-12-03
在线时长:0
4#   发表于:2015-04-08 17:28:07  IP:111.76.*.*
你自己写的方法报错请自己调试
1
级别: 商业授权用户
UID: 59821
积分:354 加为好友
威望: 4 精华: 0
主题:37 回复:222
注册时间:2014-03-28
在线时长:0
5#   发表于:2015-04-08 17:29:19  IP:121.47.*.*
回复第4楼 我去,不是方法的原因,方法没有错误
级别: 版主
UID: 70293
积分:78391 加为好友
威望: 1 精华: 0
主题:7 回复:68397
注册时间:2014-12-03
在线时长:0
6#   发表于:2015-04-08 17:30:15  IP:111.76.*.*
那你操作什么的时候报错
1
级别: 商业授权用户
UID: 59821
积分:354 加为好友
威望: 4 精华: 0
主题:37 回复:222
注册时间:2014-03-28
在线时长:0
7#   发表于:2015-04-08 17:36:56  IP:121.47.*.*
回复第6楼   我上面写的方法,一定要在jeecms-servlet-admin-action.xml  中配置太能使用吗,  我有@Controller 注解呀,为什么不能访问,有没有解决方法
级别: 版主
UID: 70293
积分:78391 加为好友
威望: 1 精华: 0
主题:7 回复:68397
注册时间:2014-12-03
在线时长:0
8#   发表于:2015-04-08 17:39:16  IP:111.76.*.*
二次开发不在服务范围内,如果有需要,可以联系售前人员,我们提供功能定制服务
1
1 共1页