I'm encountering a strange problem with the session using GXT 2.1 and a Grails 1.2 backend. I'm creating two FormPanel
s, panelA
and panelB
, which submit to action1
and action2
in Grails respectively. In action1 I set a hardcoded session variable and retrieve it开发者_如何转开发 in action2, but it is always returning null! If I manually go to action1 then follow by going to action2 in a browser it works exactly as expected. I've tried running on both Firefox and Safari in development mode and get the same result on both. Any ideas on what I should look for? Some relevant snippets:
In GXT:
final FormPanel panelA = new FormPanel();
panelA.setVisible(false);
panelA.setAction(action1);
panelA.setMethod(Method.POST);
RootPanel.get().add(panelA);
panelA.submit();
In Grails:
def a1 = {
session.a1 = "Hello A1"
println "Set A1 to $session.a1"
render "Set A1 to $session.a1"
}
def a2 = {
println "From A2, A1 is set to: $session.a1"
render "From A2, A1 is set to: $session.a1"
}
I ended up using a combination of cross domain form posts and JSON-P as a solution, it's a great workaround as I can just post the form (with a transaction id), store any feedback/results in the session, then retrieve that data using a JSON-P call.
精彩评论