작성
·
171
0
ajax를 쓰지않고 그냥 저장누르면 새로고침되면서 리스트에 추가되게 만들고있는데 java초보라 어렵네요
오류코드를 보니 sql에서 에러난거같은데 아무리봐도 제대로 넣은거같습니다.
DB에서 직접넣은 데이터는 리스트에 잘나옵니다... 근데 form에서 입력하면 아래 오류가 뜨네요..
혹시 다른문제가 있을까요? 몇시간을 삽질하고있는건지 모르겠습니다 ㅠㅠ
에러코드
2022-03-20 22:09:15,731 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
sql.xml
<sqlMap namespace="CodeSpace">
<typeAlias alias="egovMap" type="egovframework.rte.psl.dataaccess.util.EgovMap"/>
<typeAlias alias="codeVO" type="egovframework.example.sample.service.CodeVO"/>
<insert id ="codeDAO.insertCodes">
INSERT INTO codes(codegid,codegnm,code,codenm,useat)
VALUES(#codegid#,#codegnm#,#code#,#codenm#,#useat#)
</insert>
<select id="coodDAO.selectCodesList" resultClass="egovMap">
SELECT codegid,codegnm,code,codenm,useat FROM codes
ORDER BY codegid ASC
</select>
</sqlMap>
Controller
@Controller
public class CodeController {
@Resource(name="codeService")
private CodeService codeService;
@RequestMapping(value="/codeList.do")
public String selectCodesList(@ModelAttribute("Codevo") CodeVO vo, ModelMap model) throws Exception{
List<?> list = codeService.selectCodesList(vo);
System.out.println("list ===>>" + list);
model.addAttribute("resultlist",list);
return "code/codeList";
}
@RequestMapping(value="/codeWriteSave.do")
public String insertCodes(@ModelAttribute("Codevo") CodeVO vo) throws Exception{
String result = codeService.insertCodes(vo);
if (result == null) {
System.out.println("저장성공");
} else {
System.out.println("저장실패");
}
return "foward:/codeList.do";
}
}
jsp
<form:form action="/codeWriteSave.do" method="post" commandName="Codevo">
<label>그룹코드<form:input path="codegid"/>
<label>그룹명<form:input path="codegnm"/>
<label>코드<form:input path="code"/>
<label>코드명<form:input path="codenm"/>
<label>사용여부
<form:radiobutton path="useat" value="Y" label="Y"/>
<form:radiobutton path="useat" value="N" label="N"/>
</label>
<button type="submit" onclick="fn_submit(); return false">저장</button>
<button type="reset">취소</button>
</form:form>
답변