You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by terjeeit <te...@gmail.com> on 2015/06/23 08:36:15 UTC
Panel visibility with AJAX problem
Hi!
I have a BasePage with a SignedInPanel and SignedOutPanel. Visibility is
determined according to the apps internal login state AND async javascript
call (external login service). This is done in onConfigure method in
BasePage like this:
@Override
protected void onConfigure() {
super.onConfigure();
/**
* Check login-status with SPiD async and switch login-panels
according to status.
*/
checkSpidLoginStatus = new AbstractDefaultAjaxBehavior() {
@Override
protected void respond(AjaxRequestTarget target) {
MinSideSession.get().setSpidUsersFirstName(RequestCycle.get().getRequest().getRequestParameters().getParameterValue("user").toOptionalString());
if (MinSideSession.get().isAuthenticated() &&
MinSideSession.get().getSpidUsersFirstName().equals("UNKNOWN")) {
MinSideSession.get().setUser(null);
signedInPanel.setVisible(false);
signedOutPanel.setVisible(true);
} else if (MinSideSession.get().isAuthenticated() &&
!MinSideSession.get().getSpidUsersFirstName().equals("UNKNOWN")) {
signedInPanel.setVisible(true);
signedOutPanel.setVisible(false);
} else if (!MinSideSession.get().isAuthenticated() &&
!MinSideSession.get().getSpidUsersFirstName().equals("UNKNOWN")) {
signedInPanel.setVisible(true);
signedOutPanel.setVisible(false);
} else if (!MinSideSession.get().isAuthenticated() &&
MinSideSession.get().getSpidUsersFirstName().equals("UNKNOWN")) {
signedInPanel.setVisible(false);
signedOutPanel.setVisible(true);
}
target.add(signedOutPanel);
target.add(signedInPanel);
}
};
add(checkSpidLoginStatus);
}
Now, this works as expected in development mode (and when deployed on our
tomcat test-server), but when deployed in production both panels became
visible when i log out from the app (only signedOutPanel should be visible).
When i refresh the browser the signedInPanel disappears and everything is
fine again. Similar things happen if i log out of the external login-service
at another site and refreshes "my app".
Any ideas to what this issue might be?
Kind regards
Terje Eithun
Trondheim, Norway
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Panel-visibility-with-AJAX-problem-tp4671307.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Panel visibility with AJAX problem
Posted by terjeeit <te...@gmail.com>.
Yes! That was it. New version deployed, everybody happy. Thank you very much,
Sir.
Sometimes Wicket can be so...... subtle. :)
Kind regards
Terje
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Panel-visibility-with-AJAX-problem-tp4671307p4671327.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Panel visibility with AJAX problem
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
Check for JavaScript errors.
I guess that you use <wicket:container> for the signedInPanel and the JS
code that has to hide it is not able to find it in the DOM.
In production mode all <wicket:xyz> elements and attributes are stripped
from the response.
If this is the problem then just replace <wicket:container> with a <div>.
Martin Grigorov
Freelancer. Available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Tue, Jun 23, 2015 at 9:36 AM, terjeeit <te...@gmail.com> wrote:
> Hi!
>
> I have a BasePage with a SignedInPanel and SignedOutPanel. Visibility is
> determined according to the apps internal login state AND async javascript
> call (external login service). This is done in onConfigure method in
> BasePage like this:
>
> @Override
> protected void onConfigure() {
> super.onConfigure();
> /**
> * Check login-status with SPiD async and switch login-panels
> according to status.
> */
> checkSpidLoginStatus = new AbstractDefaultAjaxBehavior() {
> @Override
> protected void respond(AjaxRequestTarget target) {
>
>
> MinSideSession.get().setSpidUsersFirstName(RequestCycle.get().getRequest().getRequestParameters().getParameterValue("user").toOptionalString());
>
> if (MinSideSession.get().isAuthenticated() &&
> MinSideSession.get().getSpidUsersFirstName().equals("UNKNOWN")) {
> MinSideSession.get().setUser(null);
> signedInPanel.setVisible(false);
> signedOutPanel.setVisible(true);
> } else if (MinSideSession.get().isAuthenticated() &&
> !MinSideSession.get().getSpidUsersFirstName().equals("UNKNOWN")) {
> signedInPanel.setVisible(true);
> signedOutPanel.setVisible(false);
> } else if (!MinSideSession.get().isAuthenticated() &&
> !MinSideSession.get().getSpidUsersFirstName().equals("UNKNOWN")) {
> signedInPanel.setVisible(true);
> signedOutPanel.setVisible(false);
> } else if (!MinSideSession.get().isAuthenticated() &&
> MinSideSession.get().getSpidUsersFirstName().equals("UNKNOWN")) {
> signedInPanel.setVisible(false);
> signedOutPanel.setVisible(true);
> }
> target.add(signedOutPanel);
> target.add(signedInPanel);
> }
> };
> add(checkSpidLoginStatus);
> }
>
> Now, this works as expected in development mode (and when deployed on our
> tomcat test-server), but when deployed in production both panels became
> visible when i log out from the app (only signedOutPanel should be
> visible).
> When i refresh the browser the signedInPanel disappears and everything is
> fine again. Similar things happen if i log out of the external
> login-service
> at another site and refreshes "my app".
>
> Any ideas to what this issue might be?
>
> Kind regards
> Terje Eithun
> Trondheim, Norway
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Panel-visibility-with-AJAX-problem-tp4671307.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>