728x90
반응형
728x90
반응형
728x90
반응형

thymeleaf 3.0.10 이상을 사용하는 html에서 javascript 함수에 인수를 전달할때

 

기존에는 이렇게 작성했다.

1
<a href="#" th:onclick="${'writeProc('+ detailVO.itemSeq+')'}">Delete</a>
cs

 

하지만 아래와 같은 에러 메시지가 나온다.

 

org.thymeleaf.exceptions.TemplateProcessingException: Only variable expressions returning numbers or booleans are allowed in this context, any other datatypes are not trusted in the context of this expression, including Strings or any other object that could be rendered as a text literal. A typical case is HTML attributes for event handlers (e.g. "onload"), in which textual data from variables should better be output to "data-*" attributes and then read from the event handler.

 

그래서 thymeleaf 3.0.10 이상에서는 이렇게 바꿔야 한다.

1
<a href="#" th:onclick="writeProc( [[${detailVO.itemSeq]] )">Delete</a>
cs

 

함수 호출 부분이 보기에 좀더 직관적이라 좋다.

 

 

 

출처 : https://codeday.me/ko/qa/20190702/944892.html

728x90
반응형
728x90
반응형

난 숫자를 입력한 적없는데?

해당 변수는 문자였고 난 분명 문자를 입력했다.

 

java.lang.NumberFormatException: For input string: "N"

 

보라! 어디가 숫자냐! .....

 

요점은 N 한글자를 'N'로 입력한 아래와 같은 케이스다.

1
2
3
<if test="checkingKey != 'N'">
    AND CHECKING_KEY = #{checkingKey}
</if>
cs

 

아무래도 Java에서 char값을 'N' 같이 사용하기 때문인데,

char형은 결론적으로 숫자형이기 때문에 NumberFormatException이 나는것 같다.

 

해결책은 "checkingKey != 'N'"'checkingKey != "N"' 와 같이 따옴표 사용을 바꿔 주거나

"checkingKey != 'N'.toString()"처럼 .toString() 함수를 써주는 것이다.

 

 

 

출처 : https://yeo-eunny.tistory.com/74

 

 

728x90
반응형
728x90
반응형

Java의 VO

1
2
3
4
5
6
7
8
9
10
11
@Setter
@Getter
@ToString
public class MaterialVO {
 
    private int mtrlSeq;
    private String mtrlNm;
    private String mtrlTp;
    private String qty;
 
}
cs

====

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
@Setter
@Getter
@ToString
public class ProductVO {
 
    private int prodSeq;
    private String prodNm;
    private String recipe;
    private String showYn;
 
    // 재료 리스트
    private List<MaterialVO> material;
 
}
cs

대략 이런 구조라고 해보자.

이때 html에서는 재료리스트는 어떻게 네이밍 해줘야 할까?

 

1
2
3
4
5
6
<input type="text" name="prodSeq" th:value="${detailVO != null ? detailVO.prodSeq: '-1'}"/>
 
<!-- List  -->
<input type="text" name="material[0].mtrlNm" th:value="${detailVO.mainMaterial[0].mtrlNm}">
<input type="text" name="material[1].mtrlNm" th:value="${detailVO.mainMaterial[1].mtrlNm}">
 
cs

 

이건 thymeleaf 문법이 포함된 건데,

value 부분은 ModelAndView에 mav.addObject("detailVO", detailVO) 로 값을 넣어준 경우로 참고하면 되고,

중요건 name 부분이다. name="material[i].mtrlNm" 형태다.

 

ProductVO이 List<MaterialVO> material;

name="material[i].mtrlNm"

붉은색 부분의 네이밍이 같다는 것과 배열과 형태로 인덱스를 지정하고 마침표(.)로 변수명을 구분한다는 것을 주의하면 된다.

 

 

 

출처 : https://cofs.tistory.com/84

 

 

728x90
반응형
728x90
반응형

# 개발환경

gradle 5.6.2

jdk 1.8

springboot 2.1.9

Intellij 2018.3.5

 

최근에 프로젝트를 생성해서 war를 생성하려고 하니 컴파일 에러가 났다.

내 얇팍한 지식내에서는 이유를 모르겠는데 처음 문제를 겪고 2주가 지나서야 찾은 게시물

 

 

2019031801-Spring boot에서 Gradle 5.x 빌드 시 Lombok 관련 컴파일 오류 처리

환경 - gradle-5.2.1 - spring boot 2.1.3.release - jdk 1.8 - eclipse Gradle 빌드시 Lombok으로 처리하던 getter, setter, log 쪽이 모두 컴파일 오류가 납니다. 구글 검색을 해보고 annotationProcessor, comp..

eblo.tistory.com

정리하면 gradle 5.x 이상에서 종속성에 문제가 있다는 것으로 보인다.

 

보다 자세하 설명은 아래 링크를 참조.

 

Intellij Idea + Lombok + Gradle 5 = broken build

I'm trying to get Lombok to work with Gradle and Intellij Idea (2018.2.6). I have the following dependencies in my build.gradle: compileOnly "org.projectlombok:lombok:1.18.6" annotation...

intellij-support.jetbrains.com

 

Gradle 5.0 with Lombok and Spring Boot

I play with Lombok with Spring boot and Gradle. However, I struggled to figure out how to build the source code.

medium.com

 

결론적으로 현재 나는 gradle을 아래와 같이 고치고 사용중이다.

1
2
compileOnly("org.projectlombok:lombok:1.18.10")
annotationProcessor("org.projectlombok:lombok:1.18.10")
cs
 

 

728x90
반응형
728x90
반응형

1. File Setting -> Plugins 에서 lombok을 검색하여 설치 후 Intellij 재시작

 

2. gradle 에 lombok 추가

1
compileOnly('org.projectlombok:lombok')
cs

 

3. Setting -> Build, Execution, Deployment => Compiler
1) 'Build project automatically' 체크

2) Compiler => Annontation Processors의 'Enable annotation processing' 체크

 

 

728x90
반응형
728x90
반응형

code 413

message: 요청 엔티티가 너무 크기 때문에 페이지가 표시되지 않습니다.

error: Request Entity Too Large

 

https://forums.iis.net/t/1239202.aspx?413+Request+Entity+Too+Large  

 

iis의 업로드 사이즈에 대한 제약 문제

구성 편집기의 uploadReadAheadSize : 49152 => 20971520 (byte 단위)
요청 필터링의 허용되는 최대 컨텐츠 길이 : 30000000 => 4294967295 (byte 단위, 최대 값으로 변경함.)

 

 

관련글 : [html, ajax] bootstrap 파일 업로드 progress bar

 

 

728x90
반응형
728x90
반응형
1
2
3
4
5
6
7
8
9
10
SELECT
      T.name AS table_name, C.name AS column_name
   FROM
      sys.tables AS T
   INNER JOIN
      sys.columns AS C
   ON
      T.object_id = C.object_id
   WHERE
      C.name = '컬럼명'
cs

 

728x90
반응형

+ Recent posts