function bb(){
var keyword01 = document.getElementById("keyword01").value;
var searchFrom = document.getElementById("searchFrom").value;
var keyword02 = document.getElementById("keyword02").value;
var ldmImg= document.getElementById('ldmWarnImage');
console.log(keyword01);
console.log(searchFrom);
console.log(keyword02);
/* if(a1 =='관심 단계'){
document.getElementById('ldmWarnImage').src="/ldm/images/legend/sansatae_warning_img_1.png";
console.log(document.getElementById('ldmWarnImage'));
} else if(a1 =='주의 단계'){
document.getElementById('ldmWarnImage').src="/ldm/images/legend/sansatae_warning_img_2.png";
console.log(document.getElementById('ldmWarnImage'));
} else if(a1 =='경계 단계'){
document.getElementById('ldmWarnImage').src="/ldm/images/legend/sansatae_warning_img_3.png";
} else if(a1 =='심각 단계'){
document.getElementById('ldmWarnImage').src="/ldm/images/legend/sansatae_warning_img_4.png";
} */
$.ajax({
type : 'post',
data : {keyword01 : keyword01, searchFrom : searchFrom , keyword02: keyword02},
url : '<c:url value="/forecast/ldmSteps.do"/>',
dataType : 'json',
success : function(data) {
console.log(data);
alert('저장되었습니다');
}
});
}
jsp의 스크립트입니다.
keyword01, searchFrom, keyword02의 값을 ajax - /forecast/ldmSteps.do로 보냅니다.
@RequestMapping("/forecast/ldmSteps.do")
public String ldmSteps(HttpServletRequest request, Model model,@ModelAttribute("ldmSttmnLVO")ldmSttmnLVO vo) throws Exception{
System.out.println("test1111111111111111111111111");
System.out.println(vo.getKeyword01());
System.out.println(vo.getSearchFrom());
System.out.println(vo.getKeyword02());
System.out.println("test22222222222222222222222222");
try{
forecastInfoService.insertLdmStepList(vo);
} catch (Exception e) {
request.setAttribute("errorMessage", "에러가 발생했습니다.");
}
return "jsonView";
}
controller의 /forecast/ldmSteps.do입니다.
@ModelAttribute()로 vo에 저장됩니다.
public void insertLdmStepList (ldmSttmnLVO vo) throws Exception;
service
public void insertLdmStepList(ldmSttmnLVO vo) throws Exception
{
forecastInfoMapper.insertLdmStepList(vo);
}
serviceimpl
public void insertLdmStepList(ldmSttmnLVO vo) throws Exception
{
System.out.println("ttttttttttt");
System.out.println(ToStringBuilder.reflectionToString(vo));
insert("insertLdmStepList", vo);
}
mapper
<insert id="insertLdmStepList" parameterType="go.forest.mhms.cmm.model.ldmSttmnLVO">
<![CDATA[
INSERT INTO TB_LDM_STEPLIST
(DANR_WARN, DANR_DATE, DANR_AREA)
VALUES
(#{Keyword01},#{SearchFrom},#{Keyword02})
]]>
</insert>
mapper.xml
입니다.
mapper까진 sysout 찍어보면 vo값 잘넘어오는데..
mapper.xml에 vo값이 안받아와지는데..
문제가 무엇인지 알려주실 수 있나요??