java - Using JSTL url and param tag -
i have list of sizes user can choose from, posssible build parameter based on link user clicks?
for example, there following html
<ul class="options list-unstyled"> <h4 class="m_9">select size</h4> <li><a href="?size=s">s</a></li> <li><a href="?size=m">m</a></li> <li><a href="?size=l">l</a></li> <li><a href="?size=xl">xl</a></li> <div class="clearfix"></div> </ul>
and there in controller
@requestmapping(value = "/addprodtocart", method = requestmethod.post) public modelandview cart(@requestparam("productid") integer id, @requestparam("size") string size) {}
disregarding productid size requestparam equal ever 1 user clicked. temp variable in jstl changes whenever new size selected , form below passed built url (basically whichever size user selected)
<form method='post' action="${url }" > <input type="hidden" name="${_csrf.parametername}" value="${_csrf.token}"/> <input type="submit" value="add cart" title=""> </form>
is possible? , how? thank
Comments
Post a Comment