Spring MVC: Pass Object between Controllers Given URL -


i have controller passes list of song objects view.

this list outputted list of urls object's id property in url:

e.g.

http: //.../song/23 obtained by:

<a href="song/${song.id}">     <c:out value="${song.songname}"/>  </a> 

further details:

the question correct way forward correct song object song controller responsible in generating ...song/23 url ?

example: looping through 4 song objects should produce view 4 links.

link1 link2 link3 link4

each link corresponds song object , clicking on each link should forward unique url. e.g.: if song1's id 42 clicking on link1 should forward http: //../song/42 , pass song object corresponding link1 song controller.

i hope understood question enough, in spring mvc (annotation based), can this:

@requestmapping(value="/song/{songid}/", method=requestmethod.get) public string showsong(@pathvariable int songid) {     // } 

now can retrieve song object id (i suppose service has such feature) , have song object.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -