스프링스를 처음 접했고 jsp에서 컨트롤러로 데이터를 전달하는 데 막혔습니다 여기에 사용자가 기본 키를 클릭 한 다음 이jsp에서 스프링으로 컨트롤러로 데이터 전달하기
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<style>
.tableimp {
margin-top: 150px;
}
</style>
</head>
<body>
<table align="center" border="1" class="tableimp">
<tr>
<th bgcolor="#2E64FE">USERNAME</th>
<!-- <td> </td> -->
<th bgcolor="#2E64FE">FIRSTNAME</th>
<!-- <td> </td> -->
<th bgcolor="#2E64FE">LASTNAME</th>
<!-- <td> </td> -->
<th bgcolor="#2E64FE">EMAIL</th>
<!-- <td> </td> -->
<th bgcolor="#2E64FE">USERID</th>
</tr>
<c:forEach items="${stkList}" var="maps">
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<c:forEach items="${maps}" var="mapEntry">
<td align="center"> <c:choose>
<c:when test="${mapEntry.key eq 'userId'}">
<c:url var="userView" value="userView.do" />
<a href="<c:out value='userView.do?userId=${mapEntry.value}' />">${mapEntry.value}</a>
</c:when>
<c:otherwise>
${mapEntry.value}
</c:otherwise>
</c:choose></td>
</c:forEach>
</tr>
</c:forEach>
</table>
</body>
</html>
내 컨트롤러
@RequestMapping(value="/userView.do*", method=RequestMethod.GET)
public ModelAndView viewUser(HttpServletRequest request)
{
try{
//I need that userId Here somehow
}
catch(Exception e)
{
e.printStackTrace();
}
return new ModelAndView("form","",null);
}
을 다음과 같이
내가 나의 리스팅을 JSP로이 페이지를 볼 수있는 사용자의 수신 요청을 감지하는 기본 키는 컨트롤러에 전달해야
}
사람이 어떻게 작업을 달성하기 위해 나에게 조각을 전해 주 시겠어요
내 URL을 내가 원하는대로 브라우저에 추가 가져옵니다 로컬 호스트 : 8080/SpringMVC/userView.do userId를 = 1
나는 내 컨트롤러에서이 사용자 ID 값을 :) 이잖아 필요
당신의 질문은 명확하지 않습니다. 우리가 알아야 할 몇 가지. 그 값은 컨트롤러에 전달해야합니다 (mapEntry.value)? 브라우저에서 URL이 어떻게 보이나요? 제대로 렌더링 되었습니까 ?? 문자열을'c : out' 값과 잘못 결합하고 있기 때문에 아마 그렇지 않을 것입니다. –
컨트롤러가 무엇입니까? – user23123412