JSTL - c:url not working with form action

前端 未结 2 1237
一生所求
一生所求 2021-02-19 21:14

I am having an issue with using tag to set the path of a form in my JSP. I have it outside the form tag as well and that works fine. However it doesn\'t seem to work inside the

相关标签:
2条回答
  • 2021-02-19 22:07

    Even though Santhosh Joshi answer is preferred way, Just for informing alternative

    <sf:form commandName="user" method="post" action="${pageContext.request.contextPath}/user/add"> 
    
    0 讨论(0)
  • 2021-02-19 22:13

    You can't use a tag inside a tag. So just separate your tags as follows:

    <c:url var="post_url"  value="/user/add" />
    <sf:form commandName="user" method="post" action="${post_url}"> 
    
    0 讨论(0)
提交回复
热议问题