2014-03-14 3 views
0

내 친구,값 입력 텍스트 받기 jstl - 봄 MVC

문제가 있습니다.

나는 스프링 MVC 함께 일하고 있어요 내가 가치 넣어 :

<p><s:message code="modal.projeto.confirma_desativacao" arguments="???" htmlEscape="false"/></p> 

어떤 생각 :

<input type="hidden" name="projetoid" id="projId"/> 

을 나는 "projetoid"의 valeu을 얻을 인수로 전달할 싶습니다? JSTL로 어떻게이 가치를 얻을 수 있습니까?

+0

접두사 s에 대한 taglib uri는 무엇입니까? 그것은 jstl fmt입니까? – CodeBender

+0

<% @ taglib prefix = "c"uri = "http://java.sun.com/jsp/jstl/core"%> <% @ taglib prefix = "s"uri = "http : // www. springframework.org/tags "%> <% @ taglib prefix ="fmt "uri ="http://java.sun.com/jsp/jstl/fmt "%> – user3358703

+0

접두사 's'는 실제로 "springframework.org/tags/form"이 아닌 "springframework.org/tags"? – CodeBender

답변

0

질문을 이해하는 데 약간의 어려움이 있지만 projId의 값을 s : message arguments 속성에 전달하려는 경우이를 인식합니다. 여기 내가 테스트하고 작동하는 것으로 나타났습니다.

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<title>Insert title here</title> 
<script src="http://code.jquery.com/jquery-1.9.1.js"></script> 
</head> 
<body> 

    <input type="hidden" name="projetoid" id="projId" value="testing123"/> 

    <p><s:message id="target" code="modal.projeto.confirma_desativacao" arguments="???" htmlEscape="false"/></p> 

    <script type='text/javascript'> 
     $(document).ready(function(){ 
      var hiddenVal = $('#projId').val(); 
      $('#target').attr("arguments", hiddenVal); 
      console.log('Logged: '+$('#target').attr("arguments")); 
     }); 
    </script> 
</body> 

console.log에서 projId의 값이 성공적으로 인쇄되었습니다.

jQuery를 사용하여 작업을 수행했습니다. 문서가 준비되면 projId에서 id : target으로 값을 전달했습니다. 양식 제출시 값을 전달하려는 경우 양식을 제출할 때 값을 전송할 함수를 작성해야합니다. 희망이 =)