반응형
반응형
반응형



ajax 로 array data request 시 서버에서 받는 방법.



var a = [];

a[0] = 1;

a[1] = 2;

a[2] = 3;


$.ajax({


url : "/test.json",

type : "POST",

data: {

'array_data' : a

},

dataType: 'json',

success: function(data) {

},

error: function(data, status, err){

}

});





Spring 에서 요렇게 받을수 있다.

@RequestParam(value = "array_data[]", required = false) List<String> arrayData


sprint 3.x, jquery 1.10.x




반응형
반응형


static 필드에 @Autowired 어노테이션 사용법.

@Autowired
private static MyService myService;

위 방식으로 사용하면 exception 발생.
아래와 같이 사용해야함.

private static MyService myService;

@Autowired(required=true)
public void setMyService(MyService _myService) {
    myService = _myService;
}

반응형

'프로그래밍 > Java' 카테고리의 다른 글

[이클립스] jad clipse 플러그인.  (0) 2011.10.26
reflection을 이용한 오브젝트의 함수 실행.  (1) 2011.09.20
String -> Json  (0) 2011.09.19
http request post data 읽기.  (0) 2011.09.19
Redirect VS Forward  (0) 2011.08.31
반응형
Spring 3 버전의 applicationContext.xml 파일 설정 시 에러 발생.

설정 내용
 : <tx:annotation-driven transaction-manager="txManager"/>

에러 내용
 : java.lang.NoClassDefFoundError: org/springframework/transaction/interceptor/TransactionInterceptor

해결 방법
 : aopalliance.jar 파일 필요.
반응형

'프로그래밍 > Java' 카테고리의 다른 글

http request post data 읽기.  (0) 2011.09.19
Redirect VS Forward  (0) 2011.08.31
[안드로이드] 개발 환경 구축  (0) 2011.06.24
[링크] unsigned data type  (0) 2011.05.18
[spring] 엑셀 다운로드  (0) 2011.03.21
반응형

controller ---------------------

@Autowired
 private ExcelView excelView;

 public void setExcelView(ExcelView excelView) {
  this.excelView = excelView;
 }
............
public ModelAndView view() {
......
  ModelAndView mav = new ModelAndView(excelView);
  mav.addObject("dataList", list);
  return mav;
}


excel view ---------------------

public class excelView extends AbstractExcelView {
  List<String> list = (List<String>)model.get("dataList");

  HSSFSheet sheet = workbook.createSheet("view");
  sheet.setDefaultColumnWidth((short)12);

  HSSFRow header = sheet.createRow(0);
  header.createCell((short)1).setCellValue("header 1");
  header.createCell((short)2).setCellValue("header 2");

  HSSFRow row = sheet.createRow(1);
  row.createCell((short)1).setCellValue("data 1");
  row.createCell((short)1).setCellValue("data 1");
}


applicationContext.xml ---------------------

<bean id="excelView" class="xxx.xxx.xxxx.ExcelView"/>

반응형

'프로그래밍 > Java' 카테고리의 다른 글

[안드로이드] 개발 환경 구축  (0) 2011.06.24
[링크] unsigned data type  (0) 2011.05.18
url encoding  (0) 2011.02.18
[link] sitemesh  (0) 2011.01.17
[이클립스] 플러그인 FindBugs  (0) 2010.06.10

+ Recent posts