회원가입창
조건문 <c:choose>, <c:when>, <c:otherwise>
<c:choose>는 Java 언어의 switch~ case와 비슷하게 여러 조건중에 하나를 선택한다. <c:choose>는 switch에 해당되고 <c:when>는 case에 해당되며, <c:otherwise>는 default에 해당된다.
controller주소는 .do
jsp에서는 .do안 붙여도 가능
로그아웃 컨트롤러에서 session을 제거
HttpSession session = null;
session = request.getSession(false); //기존 세션 객체 존재시 반환. 없으면 null반환
session.invalidate();
return "/board/getBoardList.do";
오류1.
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='id', mode=IN, javaType=class java.lang.String, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting null for parameter #1 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 부적합한 열 유형: 1111
### The error may exist in query/member.xml
### The error may involve com.mvc.member.dao.memberMapper.updateInfoForm-Inline
### The error occurred while setting parameters
### SQL: SELECT id, name, email, phone, regdate FROM member where id=?
### Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='id', mode=IN, javaType=class java.lang.String, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting null for parameter #1 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 부적합한 열 유형: 1111
org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76)
com.mvc.member.dao.MemberMapperImpl.updateInfoForm(MemberMapperImpl.java:57)
com.mvc.member.service.MemberServiceImpl.updateInfoForm(MemberServiceImpl.java:51)
com.mvc.member.controller.UpdateInfoFormController.execute(UpdateInfoFormController.java:25)
com.mvc.common.controller.DispatcherServlet.process(DispatcherServlet.java:51)
com.mvc.common.controller.DispatcherServlet.doGet(DispatcherServlet.java:25)
javax.servlet.http.HttpServlet.service(HttpServlet.java:529)
javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
com.mvc.common.util.EncoderFilter.doFilter(EncoderFilter.java:25)
return값을 안 줬다...ㅠㅠ
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='id', mode=IN, javaType=class java.lang.String, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting null for parameter #1 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 부적합한 열 유형: 1111
### The error may exist in query/member.xml
### The error may involve com.mvc.member.dao.memberMapper.updateInfoForm-Inline
### The error occurred while setting parameters
### SQL: SELECT id, name, email, phone, regdate FROM member where id=?
### Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='id', mode=IN, javaType=class java.lang.String, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting null for parameter #1 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 부적합한 열 유형: 1111
org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76)
com.mvc.member.dao.MemberMapperImpl.updateInfoForm(MemberMapperImpl.java:57)
com.mvc.member.service.MemberServiceImpl.updateInfoForm(MemberServiceImpl.java:51)
com.mvc.member.controller.UpdateInfoFormController.execute(UpdateInfoFormController.java:25)
com.mvc.common.controller.DispatcherServlet.process(DispatcherServlet.java:51)
com.mvc.common.controller.DispatcherServlet.doGet(DispatcherServlet.java:25)
javax.servlet.http.HttpServlet.service(HttpServlet.java:529)
javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
com.mvc.common.util.EncoderFilter.doFilter(EncoderFilter.java:25)
session으로 값을 가져와서 해주니 해결
부적합한 열유형
name, id 값 오타가 났다.
java.sql.SQLException: 부적합한 열 유형: 1111
oracle.jdbc.driver.OracleStatement.getInternalType(OracleStatement.java:4031)
oracle.jdbc.driver.OraclePreparedStatement.setNullCritical(OraclePreparedStatement.java:4182)
oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.java:4166)
oracle.jdbc.driver.OraclePreparedStatementWrapper.setNull(OraclePreparedStatementWrapper.java:1008)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.base/java.lang.reflect.Method.invoke(Method.java:568)
org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:67)
jdk.proxy3/jdk.proxy3.$Proxy8.setNull(Unknown Source)
org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:65)
org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:87)
org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:94)
org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:64)
org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:88)
org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)
org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:89)
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76)
com.mvc.member.dao.MemberMapperImpl.updateMember(MemberMapperImpl.java:38)
com.mvc.member.service.MemberServiceImpl.updateMember(MemberServiceImpl.java:56)
com.mvc.member.controller.UpdateMemberController.execute(UpdateMemberController.java:27)
com.mvc.common.controller.DispatcherServlet.process(DispatcherServlet.java:51)
com.mvc.common.controller.DispatcherServlet.doGet(DispatcherServlet.java:25)
javax.servlet.http.HttpServlet.service(HttpServlet.java:529)
javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
com.mvc.common.util.EncoderFilter.doFilter(EncoderFilter.java:25)
update에서는 반환형이 int라 MemberVO를 반환해 주는 것이 아니라 int값을 반환해 줘야 한다.
mapper에서 쓰인
<update id="appTest">
update ~ set ~ 이 구문이
</update>
controller에 와서
int a = service.appTest(~)
a.put("success", (a==1));
이런식으로 오는 것을 발견했다.
아니, 리턴값이 없는데 갑자기 int...?
찍어보니 1을 리턴하는 걸 보고 읭했다.
찾아보니 insert, update, delete에는 resultType이 없고
row의 개수를 반환한다고 한다.
insert의 경우는 삽입된 행의 개수를 반환
update의 경우는 수정에 성공한 행의 개수를 반환(실패시 0 반환)
delete의 경우는 삭제한 행의 개수를 반환
즉, 저 구문은 update 성공시에 웬만하면 1을 반환하고
실패시는 0이므로 put에 success를 넣은 것
Cannot invoke "com.mvc.common.controller.Controller.execute(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)" because "ctrl" is null
맵핑을 주석 처리 해놓은걸 해제 안했었다.