How to use url rewriting concept?

226 views Asked by At

How to use URL rewriting in <s:Form action="delete"> in this below code how to resolve this error

  <s:iterator value="masterlist" var="item">
  <tr bordercolor="#E6E6E6"> 
  <td><a href="<s:url namespace="" action="uncchequepopulate1">
   <s:param name="chequeNumber" value="%{#item.chequeNo}" /></s:url>">
   <s:property value="%{#item.doncd}" />
  </a>
  </td>

  <td><s:property value="%{#item.dondesc}" /> </td> 
  <td><s:property value="%{#item.dondesce}" /></td> 
  <td><s:property value="%{#item.accno}" /></td>
   <center> <td>
   <s:form action="delete?doncod=<s:property value="%{#item.doncd}" />" >
    <s:submit value="Delete" theme="simple"></s:submit></s:form></td><center>

  <center> <td> <s:form action="modify" name="regform" id="formSelectOne"  theme="simple">
  <s:submit value="MODIFY" theme="simple"></s:submit></s:form></td> </center>
  </s:iterator>     

how to resolve this error

   HTTP Status 500 - /Masterindex.jsp (line: 116, column: 60) Unterminated `<s:form>` tag this error will be display how to resolve
1

There are 1 answers

0
Roman C On

You can build the URL with the s:url tag with parameters before you use it with the form tag. The s:form tag uses the action attribute to map with the action but it also accept URLs if they are properly formatted. That what we will do now.

<s:url var="deleteUrl" action="delete" includeContext="false"><s:param name="doncod" value="%{#item.doncd}"/></s:url>
<s:form action="%{#deleteUrl.substring(1)}" method="POST">

Another approach, which most recommended is to use hidden field as request parameter to hold the value submitted with the form.

<s:form action="delete" method="POST">
<s:hidden name="doncod" value="%{#item.doncd}"/>

So, these two methods could be used to pass a parameter with the form action.