JSP | JSP 함수
페이지 정보
작성자 굿스웹 작성일20-02-20 18:25 조회780회 댓글0건관련링크
본문
private String
[get값 받기]
@RequestMapping(value = "/log.do", method = RequestMethod.GET)
public void student(HttpServletRequest httpServletRequest,Model model) throws Exception{
String id = httpServletRequest.getParameter("id");
[로그출력]
System.out.println("x:"+id);
[로그 화면 출력]
import java.util.Locale;
private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
[내용 페이지 뷰]
ModelAndView mav = new ModelAndView();
mav.setViewName("view");
mav.addObject("변수", id);
[예외처리]
try {
} catch (Exception e) {
e.printStackTrace();
} finally {
}
[디비]
conn = dataSource.getConnection();
st = conn.createStatement();
ResultSet rs = st.executeQuery("select now() as now;");
while(rs.next()) {
model.addAttribute("serverTime", rs.getString("now"));
}
st.close();
Map<Object, Object> map = new HashMap<Object, Object>(); //1. 맵 선언
map.put("UserTitle", list);
[addAttribute,addFlashAttribute로]
rttr.addAttribute로 전달한 값은 url뒤에 붙으며, 리프레시해도 데이터가 유지된다.
rttr.addFlashAttribute로 전달한 값은 url뒤에 붙지 않는다. 데이터가 소멸
[get값 받기]
@RequestMapping(value = "/log.do", method = RequestMethod.GET)
public void student(HttpServletRequest httpServletRequest,Model model) throws Exception{
String id = httpServletRequest.getParameter("id");
[로그출력]
System.out.println("x:"+id);
[로그 화면 출력]
import java.util.Locale;
private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
[내용 페이지 뷰]
ModelAndView mav = new ModelAndView();
mav.setViewName("view");
mav.addObject("변수", id);
[예외처리]
try {
} catch (Exception e) {
e.printStackTrace();
} finally {
}
[디비]
conn = dataSource.getConnection();
st = conn.createStatement();
ResultSet rs = st.executeQuery("select now() as now;");
while(rs.next()) {
model.addAttribute("serverTime", rs.getString("now"));
}
st.close();
Map<Object, Object> map = new HashMap<Object, Object>(); //1. 맵 선언
map.put("UserTitle", list);
[addAttribute,addFlashAttribute로]
rttr.addAttribute로 전달한 값은 url뒤에 붙으며, 리프레시해도 데이터가 유지된다.
rttr.addFlashAttribute로 전달한 값은 url뒤에 붙지 않는다. 데이터가 소멸
[주소복사] https://www.goodsweb.kr/?u=D41dXTH
SNS 알리기
핀터레스트
텔레그램로
블로그로
페이스북
트위터
카카오스토리
카톡 공유
관련 블로그
로딩중