How to pass value from url (taken from JSP) to the controller in Spring MVC -


i'm trying create delete button in jsp delete rows in db. clicking on button row id , set in url this:

<tr>  	<td><c:out value="${project.projectid}" /></td>  	<td><c:out value="${project.title}" /></td>  	<td><c:out value="${project.domain}" /></td>  	<td><c:out value="${project.lang}" /></td>  	<td><c:out value="${project.author}" /></td>  	<td><c:out value="${project.created}" /></td>  	<td><a href="${pagecontext.request.contextpath}/project/edit/${project.projectid}">edit</a>      <a href="${pagecontext.request.contextpath}/project/delete/${project.projectid}">delete</a>  	</td>

and url get: http://localhost:8080/irs/project/delete/414

now 414 row id. @ point want sent id controller , there delete row. can please me on that. thank you

this url can mapped following in controller:

@requestmapping(value="/project/delete/{projid}") public string deletefunction(@pathvariable string projid){    ...  } 

edit: without having detailed information project, little bit hard answer question. information i'm talking is: project folder structure, web.xml, application context configurations, if configurations xml or annotation based. if not experienced in spring mvc, i'd suggest to:

  • carefully read this documentation
  • take @ this , this spring project templates understand spring mvc.

definitively issue in controller mapping. verify if in context configuration file (equivalent /src/main/webapp/web-inf/application-servlet.xml this template) have <mvc:annotation-driven/>


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -