This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
OK, I now know that I don't grok the difference between "forwardToView" and "forwardToCommand" and how that ties into the GET or POST commands.
I've read Bear's javadocs, and the JEE javadocs, and I don't get it.
I've got a nice Bean that declares:
at the end of its execute() function, I want to cause a GET on the page foo.jsp.
Neither forwardToCommand() nor forwardToView() does what I want, and I don't see how the redirectTo* would do better.
Bear Bibeault wrote:What you want is the redirect.
This seems to partly be the answer. From the FrontMan javadocs, it appears that
are the same, with the former just a conveniece wrapper to the latter. But I get different results.
Specifically, the latter works great. The first version throws an exception:
StandardWrapperValve[CommandBroker]: PWC1406: Servlet.service() for servlet CommandBroker threw exception
org.bibeault.frontman.ViewNotFoundException: View with name of foo not found
So they clearly are not the same. What's the real difference? Why does one work and the other complain?
it says "sue" when it should say "use"
redirect() redirects to the URl that you pass to it.
redirectToView() constructs a URL to the specified view (as a convenience) and then redirects to it. In your example, it will construct a redirect to foo.jsp in the folder that you specified as the views root in the init config.
Bear Bibeault wrote:I'm actually surprised that the vanilla redirect works with that parameter. What exactly are you trying to redirect to?
a simple JSP. I was using forwardToView, but it wasn't doing the GET, which led me to the initial posting in this thread.
It worked at one level using forwardToView, but was just finishing the initial request GET/POST. and I really want a new request.
Actually, I really would rather not clank out to the browser, but if that's what it takes, OK.