Note that there are some explanatory texts on larger screens.

plurals
  1. POspring params not working exactly for my requirement
    primarykey
    data
    text
    <p><strong>Scenario</strong></p> <p>Am working with spring mvc, I have a situation which i couldn't address. I have one search and list page . When am doing search operation am passing a parameter <strong>'data'</strong> and after that from the list i perform some addition operation for that am passing a parameter <strong>"save"</strong>.</p> <p>This is how my controller methods look like.</p> <pre><code> @RequestMapping(value = "/abc", method = RequestMethod.GET, params = { "data" }) public String abcMethod() {} @RequestMapping(value = "/def", method = RequestMethod.GET, params = { "save" }) public String defMethod() {} </code></pre> <p><strong>Problem</strong> All the functionality are performing get method so when i add some thing after finished my search operation my url append both <strong>data and save param</strong> So i modified my save method like this</p> <pre><code> @RequestMapping(value = "/abc", method = RequestMethod.GET, params = { "save", "data" }) public String abcMethod() {} </code></pre> <p>And its working fine for whenever i add something immediately after my search because in my url am having both parameters.</p> <p>In the same form also i have some post functionality if i performed anything and i did add means in my url am getting only <strong>save</strong> parameter not "data", So my above code not working.</p> <p><strong>Expected output:</strong></p> <p>Even if i have and not <strong>data</strong> param in my url i have to correctly redirect my controller to my save method. For this how i have to put my parameters</p> <p><strong>Things i tried:</strong></p> <p>To solve this i tried something like this</p> <pre><code> @RequestMapping(value = "/abc", method = RequestMethod.GET, params = { "save", "!data" // added one not symbol before data }) public String abcMethod() {} </code></pre> <p>Its working fine for after post methos where params not passing but fails in immediate hit of after search where am getting both parameter.</p> <p><strong>EDIT</strong> Am using display tag so i should use only GET method for add due to some other design structure also am passing just id from the table remaining am taken from session where i kept the list so i couldn't use <strong>POST</strong> method here.</p> <p>Please help to redesign my controller.</p> <p>Thanks for your reply </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload