You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by insom <da...@gmail.com> on 2008/08/11 21:47:17 UTC

Feedback messages disappearing before display

I have a submit button that adds a message to my FeedbackPanel, like so:

if (isTestPassed()) {
	...
} else {
	setResponsePage(TestPage.class);
	info("You didn't pass the test...");
}

However, when the browser gets to the TestPage, it doesn't display any
messages. I stepped through the process in Eclipse. Running
getSession().getFeedbackMesages() in the debugger shows that the message did
get registered. However, when it gets to line 1367 in RequestCycle (Wicket
1.3.4), the message is removed. Here is the relevant code from RequestCycle:

1361  finally
1362  		{
1363  			// set step manually to clean up
1364  			currentStep = DETACH_REQUEST;
1365  
1366  			// clean up the request
1367  			detach();  <-- This is where the message disappears
1368  
1369  			// set step manually to done
1370  			currentStep = DONE;
1371  		}

I have no idea what to do to fix this. Any suggestions?
-- 
View this message in context: http://www.nabble.com/Feedback-messages-disappearing-before-display-tp18932342p18932342.html
Sent from the Wicket - User 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: Feedback messages disappearing before display

Posted by Matej Knopp <ma...@gmail.com>.
If you want to show messages on another page you need to use session
feedback messages (getSession().info)

-Matej

On Mon, Aug 11, 2008 at 9:47 PM, insom <da...@gmail.com> wrote:
>
> I have a submit button that adds a message to my FeedbackPanel, like so:
>
> if (isTestPassed()) {
>        ...
> } else {
>        setResponsePage(TestPage.class);
>        info("You didn't pass the test...");
> }
>
> However, when the browser gets to the TestPage, it doesn't display any
> messages. I stepped through the process in Eclipse. Running
> getSession().getFeedbackMesages() in the debugger shows that the message did
> get registered. However, when it gets to line 1367 in RequestCycle (Wicket
> 1.3.4), the message is removed. Here is the relevant code from RequestCycle:
>
> 1361  finally
> 1362            {
> 1363                    // set step manually to clean up
> 1364                    currentStep = DETACH_REQUEST;
> 1365
> 1366                    // clean up the request
> 1367                    detach();  <-- This is where the message disappears
> 1368
> 1369                    // set step manually to done
> 1370                    currentStep = DONE;
> 1371            }
>
> I have no idea what to do to fix this. Any suggestions?
> --
> View this message in context: http://www.nabble.com/Feedback-messages-disappearing-before-display-tp18932342p18932342.html
> Sent from the Wicket - User 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
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Feedback messages disappearing before display

Posted by insom <da...@gmail.com>.
I tried to follow your suggestions, but it is still not displaying messages
in the panel.


nanotech wrote:
> 
> I believe you want to display the feedback message in "TestPage".
> 

Yes, that's correct. TestPage extends BaseTemplate, which contains this:

BaseTemplate.java:
MessagePanel messagePanel = new MessagePanel("messages")	{
	private static final long serialVersionUID = 1L;
	public boolean isVisible()
	{
		return anyMessage();
	}
}; 
add(messagePanel);			

BaseTemplate.html:
<div wicket:id="messages" style="width: 600px; margin-left: 100px;">This is
the spot for error/info messages</div>
<wicket:child>This is where TestPage is included</wicket:child>

MessagePanel trivially extends FeedbackPanel:

MessagePanel.java:
public abstract class MessagePanel extends FeedbackPanel
{
	public MessagePanel(final String id)
	{
		super(id);		
	}
}


nanotech wrote:
> 
> If so, do something like this:
> 1. make sure you have feedback panel added on the page where you will be
> landing after redirect.
> 

If I understand Wicket inheritance, that is taken care of with what I showed
above.


nanotech wrote:
> 
> 2. Then you can get hold of the feedback panel in the current page like
> shown below:
> 
> FeedbackPanel feedback = (FeedbackPanel)
> responsePage.get("responsePage-feedbackPanel");
> getSession().info("You pased the test");
> 

Here's how I tried to implement your advice. I wasn't clear on what you
meant by "responsePage.get("responsePage-feedbackPanel")", so I tried
instantiating TestPage for that, as you can see below. I'm afraid it didn't
work, though:

if (isTestPassed()) {
  ...
} else {
	TestPage testPage = new TestPage();
	MessagePanel feedback = (MessagePanel)testPage.get("messages"); 
	info("You didn't pass the test...");
	setResponsePage(TestPage.class);				
}

Can you tell me what I'm doing wrong? Thanks for your time and help.
-- 
View this message in context: http://www.nabble.com/Feedback-messages-disappearing-before-display-tp18932342p18933293.html
Sent from the Wicket - User 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: Feedback messages disappearing before display

Posted by nanotech <ra...@gmail.com>.
Hi,

I believe you want to display the feedback message in "TestPage". If so,
do something like this:
1. make sure you have feedback panel added on the page where you will be
landing after redirect.
2. Then you can get hold of the feedback panel in the current page like
shown below:

FeedbackPanel feedback = (FeedbackPanel)
responsePage.get("responsePage-feedbackPanel");
getSession().info("You pased the test");

So your code would look like:
if (isTestPassed()) {
	...
} else 
{
// response Page is the page where you will be going. In your case TestPage.
FeedbackPanel feedback = (FeedbackPanel)
responsePage.get("responsePage-feedbackPanel");
getSession().info("You did not pass the test");
setResponsePage(TestPage.class);
}



insom wrote:
> 
> I have a submit button that adds a message to my FeedbackPanel, like so:
> 
> if (isTestPassed()) {
> 	...
> } else {
> 	setResponsePage(TestPage.class);
> 	info("You didn't pass the test...");
> }
> 
> However, when the browser gets to the TestPage, it doesn't display any
> messages. I stepped through the process in Eclipse. Running
> getSession().getFeedbackMesages() in the debugger shows that the message
> did get registered. However, when it gets to line 1367 in RequestCycle
> (Wicket 1.3.4), the message is removed. Here is the relevant code from
> RequestCycle:
> 
> 1361  finally
> 1362  		{
> 1363  			// set step manually to clean up
> 1364  			currentStep = DETACH_REQUEST;
> 1365  
> 1366  			// clean up the request
> 1367  			detach();  <-- This is where the message disappears
> 1368  
> 1369  			// set step manually to done
> 1370  			currentStep = DONE;
> 1371  		}
> 
> I have no idea what to do to fix this. Any suggestions?
> 

-- 
View this message in context: http://www.nabble.com/Feedback-messages-disappearing-before-display-tp18932342p18932704.html
Sent from the Wicket - User 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: Feedback messages disappearing before display

Posted by Matej Knopp <ma...@gmail.com>.
If you want to show messages on another page you need to use session
feedback messages (getSession().info)

-Matej

On Mon, Aug 11, 2008 at 9:47 PM, insom <da...@gmail.com> wrote:
>
> I have a submit button that adds a message to my FeedbackPanel, like so:
>
> if (isTestPassed()) {
>        ...
> } else {
>        setResponsePage(TestPage.class);
>        info("You didn't pass the test...");
> }
>
> However, when the browser gets to the TestPage, it doesn't display any
> messages. I stepped through the process in Eclipse. Running
> getSession().getFeedbackMesages() in the debugger shows that the message did
> get registered. However, when it gets to line 1367 in RequestCycle (Wicket
> 1.3.4), the message is removed. Here is the relevant code from RequestCycle:
>
> 1361  finally
> 1362            {
> 1363                    // set step manually to clean up
> 1364                    currentStep = DETACH_REQUEST;
> 1365
> 1366                    // clean up the request
> 1367                    detach();  <-- This is where the message disappears
> 1368
> 1369                    // set step manually to done
> 1370                    currentStep = DONE;
> 1371            }
>
> I have no idea what to do to fix this. Any suggestions?
> --
> View this message in context: http://www.nabble.com/Feedback-messages-disappearing-before-display-tp18932342p18932342.html
> Sent from the Wicket - User 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
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Feedback messages disappearing before display

Posted by insom <da...@gmail.com>.
That solved it. I'm surprised -- considering that the original
getSession().getFeedbackMessages() showed the message, I had assumed that it
was being attached to the session. I guess I still have a lot to learn :)
Thanks for your help.


Matej Knopp-2 wrote:
> 
> If you want to show messages on another page you need to use session
> feedback messages (getSession().info)
> 
> -Matej
> 

-- 
View this message in context: http://www.nabble.com/Feedback-messages-disappearing-before-display-tp18932342p18933971.html
Sent from the Wicket - User 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: Feedback messages disappearing before display

Posted by Matej Knopp <ma...@gmail.com>.
If you want to show messages on another page you need to use session
feedback messages (getSession().info)

-Matej

On Mon, Aug 11, 2008 at 9:47 PM, insom <da...@gmail.com> wrote:
>
> I have a submit button that adds a message to my FeedbackPanel, like so:
>
> if (isTestPassed()) {
>        ...
> } else {
>        setResponsePage(TestPage.class);
>        info("You didn't pass the test...");
> }
>
> However, when the browser gets to the TestPage, it doesn't display any
> messages. I stepped through the process in Eclipse. Running
> getSession().getFeedbackMesages() in the debugger shows that the message did
> get registered. However, when it gets to line 1367 in RequestCycle (Wicket
> 1.3.4), the message is removed. Here is the relevant code from RequestCycle:
>
> 1361  finally
> 1362            {
> 1363                    // set step manually to clean up
> 1364                    currentStep = DETACH_REQUEST;
> 1365
> 1366                    // clean up the request
> 1367                    detach();  <-- This is where the message disappears
> 1368
> 1369                    // set step manually to done
> 1370                    currentStep = DONE;
> 1371            }
>
> I have no idea what to do to fix this. Any suggestions?
> --
> View this message in context: http://www.nabble.com/Feedback-messages-disappearing-before-display-tp18932342p18932342.html
> Sent from the Wicket - User 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
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org