I'm looking to cut out the JSP middleman here. I have a POST Spring endpoint that returns a string representing a view. This view is a JSP ("the middleman") that simply POSTs hidden HTML input elements on $(document).ready() to another system's URL. In order to remove this JSP, I will need to stuff the request parameters w/in the calling controller already mentioned (e.g., request.setAttribute("var1", "val1")).
First question: should I do this by returning a "forward:" + URL? A redirect does not seem to be an option because the outside-system's endpoint is expecting a POST (instead of a get in what would be the first post-redirect-get pattern of this flow).
Second question: There is a loop in the JSP that stuffs the same hidden input element multiple times:
<c:forEach var="elem" items="${requestScope.elements}">
<input type="hidden" name="thing" value="<c:out value="${elem}"/>">
</c:forEach>
How would I migrate this to the calling controller?
Aucun commentaire:
Enregistrer un commentaire