spring - How to pass on a value from a jsp to conroller and back to a jsp while using jsps in Apache tiles? -
i have configured tiles spring web project.
the tiles.xml looks follows
<tiles-definitions> <definition name="template" template="/web-inf/jsp/template.jsp"> <put-attribute name="header" value="/web-inf/jsp/header.jsp" /> <put-attribute name="body" value="/web-inf/jsp/ads.jsp "/> <put-attribute name="center" value="/web-inf/jsp/ads.jsp" /> <put-attribute name="footer" value="/web-inf/jsp/footer.jsp" /> </definition> <definition name="header" extends="template"> <put-attribute name="header" value="/web-inf/jsp/header.jsp" /> <put-attribute name="body" value="/web-inf/jsp/ads.jsp" /> </definition> <definition name="numberresult" extends="template"> <put-attribute name="body" value="/web-inf/jsp/numberresult.jsp" /> </definition> <definition name="nameresult" extends="template"> <put-attribute name="body" value="/web-inf/jsp/nameresult.jsp" /> </definition> </tiles-definitions>
now problem have input field titled studentname in header.jsp.
lets user come in "abcd" in input field. pass controller , homecoming nameresult.jsp (where page has header.jsp part of tiles).
i want prepare next 2 issues.
1) want retain "abcd" in input field in header.jsp when homecoming controller , display user in input field.
2) want utilize value "abcd"(which in header.jsp) nameresult.jsp ajax request.
header.jsp code
<div id="mycontainer"> <form method="get" action="number" id="number"> <!-- <div id="regnoerrormsgnumber">only numbers allowed</div> --> <div style="text-align: center;" > <!-- //todo: number, no spaces, no special symbol , 12 digit check--> <input width="20" type="text" data-validation="numbers" id="regno" name="regno" size="30" maxlength="50" placeholder="enter register number"> <b>or</b> </div> </form> <form method="post" action="name" id="name"> <input type="text" id="studentname" name="studentname" size="30" maxlength="50" placeholder="enter pupil name"></input> <c:set var="salary" scope="session" value="${2000*2}"/> </form> </div>
i presuming have controller method homecoming type modelandview. need utilize addobject(parametername, parametervalue); method of modelandview , should able value on jsp, , able utilize value create ajax request
spring jsp spring-mvc java-ee jstl
No comments:
Post a Comment