Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a scenario to pass values from one request to another subsequent rquest. (i.e) I will call 'Controller1' on the first request and take the request parameters or query string and should send them to 'Controller2' as 'new request'.

Strictly I should not use any of the following approaches.

  1. should not use sessions.
  2. should not use cookies.
  3. should not use requestdispatcher.forward(--).
  4. without FlashAttributes (which internally uses session, which won't work in 'Clustered environmnets').
  5. should not expose the ModelAttribues in request parameters in case of redirection (i.e) I should not even expose them as request parameters using spring RedirectView.

please let me know, if we have any alternative approch. Thanks in advance.

share|improve this question

1 Answer 1

You could call the underlying method directly

So if you have as controller2 :

@RequestMapping(value = "/MyURL", method = RequestMethod.POST)
public String myMethod(final BaseDTO baseDTO, Model model) {}

Inject controller2 into controller1 and call "normally":

controller2.myMethod(baseDTO, model);
share|improve this answer
    
"Inject controller2 into controller1" ew, that smells bad –  Sean Patrick Floyd Jun 14 '13 at 8:03
    
@SeanPatrickFloyd I would be interested in any "less smelly" solution ... refactor th elogic and stick the code in a separate service class ? –  NimChimpsky Jun 14 '13 at 8:05
    
Given the OPs "Strictly I should not use any of the following approaches." List: good luck –  Sean Patrick Floyd Jun 14 '13 at 8:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.