Re: refresh page from an AjaxLink or OnChangeAjaxBehavior

2012-05-10 Thread jensiator
Do you really need to call this?
setResponse(currentPage.getClass(), currentPage.getPageParameters()); 

If its just some components on the same page that will be affected by the
dropdown change, the above solution feels unnecessary. If you use ajax or
javascript the page don't need to be updated in a ordinary. request 

You could just update the component/components on the page that my be
affected by the dropdown change. You can do this by adding these components
to the AjaxRequestTarget.
If you add a AjaxFormComponentUpdatingBehavior on the dropdown, and a model
to the page, you would even update the model with the dropdown value. Any
components that you have added to the AjaxRequestTarget would then render.
In these affected components you can either override onComponentTag or
--TagBody to change it rendered values. I prefer to give the components a
specialized model. 
in wicket 1.5 you can do it even decoupled. 

If I not completely off target I can give you some code examples..



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/refresh-page-from-an-AjaxLink-or-OnChangeAjaxBehavior-tp4614698p4623193.html
Sent from the Users forum mailing list archive at Nabble.com.

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



refresh page from an AjaxLink or OnChangeAjaxBehavior

2012-05-07 Thread Mihai Toma
Hi,

 

I have an OnChangeAjaxBehavior on a DropDownChoice component.

 

After I change a value in that drop down I want to reload the page using
setResponse(currentPage.getClass(), currentPage.getPageParameters());

 

themeComp.add(new OnChangeAjaxBehavior() {

private static final long
serialVersionUID = -1973825163343103968L;

 

@Override

protected void
onUpdate(final AjaxRequestTarget arg0) {

 
setAValueInSession();

setResponse(currentPage.getClass(), currentPage.getPageParameters());

}

});

 

The response from ajax debug is ERROR: Wicket.Ajax.Call.failure: Error
while parsing response: Could not find root ajax-response element. I
receive the content from ajax but it is not between ajax-response element.

 

I verify this problem on AjaxLink and the response is the same as from
OnChangeAjaxBehavior.

 

Do you have any idea how to reload the page from an AjaxLink or
OnChangeAjaxBehavior ?

 

Thanks,

Mihai



RE: refresh page from an AjaxLink or OnChangeAjaxBehavior

2012-05-07 Thread Mihai Toma
Forgot to say wicket 1.5.5.

Mihai

-Original Message-
From: Mihai Toma [mailto:mihai.t...@asf.ro] 
Sent: Monday, May 07, 2012 3:47 PM
To: users@wicket.apache.org
Subject: refresh page from an AjaxLink or OnChangeAjaxBehavior

Hi,

 

I have an OnChangeAjaxBehavior on a DropDownChoice component.

 

After I change a value in that drop down I want to reload the page using
setResponse(currentPage.getClass(), currentPage.getPageParameters());

 

themeComp.add(new OnChangeAjaxBehavior() {

private static final long
serialVersionUID = -1973825163343103968L;

 

@Override

protected void
onUpdate(final AjaxRequestTarget arg0) {

 
setAValueInSession();

setResponse(currentPage.getClass(), currentPage.getPageParameters());

}

});

 

The response from ajax debug is ERROR: Wicket.Ajax.Call.failure: Error
while parsing response: Could not find root ajax-response element. I
receive the content from ajax but it is not between ajax-response element.

 

I verify this problem on AjaxLink and the response is the same as from
OnChangeAjaxBehavior.

 

Do you have any idea how to reload the page from an AjaxLink or
OnChangeAjaxBehavior ?

 

Thanks,

Mihai



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



Re: refresh page from an AjaxLink or OnChangeAjaxBehavior

2012-05-07 Thread Martin Grigorov
This should just work.
Not sure why it breaks for you.
Create a quickstart app and attach it to a ticket.

On Mon, May 7, 2012 at 3:53 PM, Mihai Toma mihai.t...@asf.ro wrote:
 Forgot to say wicket 1.5.5.

 Mihai

 -Original Message-
 From: Mihai Toma [mailto:mihai.t...@asf.ro]
 Sent: Monday, May 07, 2012 3:47 PM
 To: users@wicket.apache.org
 Subject: refresh page from an AjaxLink or OnChangeAjaxBehavior

 Hi,



 I have an OnChangeAjaxBehavior on a DropDownChoice component.



 After I change a value in that drop down I want to reload the page using
 setResponse(currentPage.getClass(), currentPage.getPageParameters());



 themeComp.add(new OnChangeAjaxBehavior() {

                                                private static final long
 serialVersionUID = -1973825163343103968L;



                                                @Override

                                                protected void
 onUpdate(final AjaxRequestTarget arg0) {


 setAValueInSession();

 setResponse(currentPage.getClass(), currentPage.getPageParameters());

                                                }

                                });



 The response from ajax debug is ERROR: Wicket.Ajax.Call.failure: Error
 while parsing response: Could not find root ajax-response element. I
 receive the content from ajax but it is not between ajax-response element.



 I verify this problem on AjaxLink and the response is the same as from
 OnChangeAjaxBehavior.



 Do you have any idea how to reload the page from an AjaxLink or
 OnChangeAjaxBehavior ?



 Thanks,

 Mihai



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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: refresh page

2009-06-12 Thread Luther Baker

 mount the page with hybridurlcodingstrategy and your problems will go away.


Flawless Victory!

Thanks everybody,

-Luther


Re: refresh page

2009-06-12 Thread Luther Baker
Ok, so that 'almost' wraps this up. HypbridUrlCodingStrategy works perfectly
for the Ajax-added data.

My last problem is related to the form fields. In
AjaxFallbackButton.onSubmit ... I clean out the input that holds the value
I've just added to the database and redisplayed in a list to the user. But,
on subsequent manual browser refresh, the INPUT that I wiped refreshes with
the user's LAST INPUT.

I don't mind this for the title, content or other input fields on the page -
but I don't want values showing up that I manually removed. I think this is
part of standard browser/form fields behavior.

I think Mike's approach would work here: ie: javascript that clears this
input out on load. I 'never' want any values in this input on load. I know
how to write an IHeaderContributor - is there something similar to add a
body=onload? If not, my specific page (Java/html) doesn't really create the
body tag ... what is the best way to grab it so that I can possibly add a
behavior that would create an onLoad handler.

Or, is there a better, wicket way to make sure this input is empty on
browser refresh?

Thanks,

-Luther


// add a category to the view
// and clean out input that supplied it
// dbase code intentionally left out

final AjaxFallbackButton addCategoryButton = new
AjaxFallbackButton(add-category, new ResourceModel(m-add-category),
this)
{
private static final long serialVersionUID = 1L;

@Override
protected void onSubmit(final AjaxRequestTarget target,
final Form? form)
{
final IModelString model =
categoryCandidate.getModel();
final String text = model.getObject();

// make sure we should actually do something
if (text == null)
{
return;
}

// cleans out the form.INPUT
model.setObject(new String());

// add the new text to the categoriesModel (custom Set)
categoriesModel.add(text);

// redraw the form.INPUT
target.addComponent(categoryCandidate);

// redraw the li of categories
target.addComponent(categoriesParent);
}

};


To test the idea ... this works when placed in the markup after the input I
want to clean out:

script type=text/javascript
document.getElementById(category_candidate1e).value =
'';
/script

But I can't leave this embedded in the HTML ... and I guess the ID can
change per wicket's whim. I need to add this to an body.onload event as a
behavior --- how to do I get ahold of the body element from within my
Page.java?


refresh page

2009-06-11 Thread Luther Baker
If I add a few values to a page div ala an Ajax button - and the user hits
refresh on the page, the new values I've added go away.

The user is completing a form - but hasn't formally submitted the form yet -
so there is nothing stored in the database yet. The browser naturally
re-renders the textarea and input values to the screen - but wipes out
content to any divs I might have dynamically added data to.

What would be the wicket way to allow these dynamic divs to survive a page
refresh? Maybe on the a 'wicket-example'?

Thanks,

-Luther


AW: refresh page

2009-06-11 Thread Dorothée Giernoth
Hmm, is that possible ... you can't like store session-data in the browser, do 
you? You can only store session-details in the database on the fly with ajax 
while the user still fills out the form to allow the user to re-create the 
session on next login or something like this if he accidently hits reload (but 
even then I am not sure if that works ... maybe if you write the not yet 
submitted but in the form included information back into the fields when the 
site is rendered) ... 

Does that make sense ... or I am not understanding the question ;)

- dg 
 

-Ursprüngliche Nachricht-
Von: Luther Baker [mailto:lutherba...@gmail.com] 
Gesendet: Donnerstag, 11. Juni 2009 13:27
An: users@wicket.apache.org
Betreff: refresh page

If I add a few values to a page div ala an Ajax button - and the user hits
refresh on the page, the new values I've added go away.

The user is completing a form - but hasn't formally submitted the form yet -
so there is nothing stored in the database yet. The browser naturally
re-renders the textarea and input values to the screen - but wipes out
content to any divs I might have dynamically added data to.

What would be the wicket way to allow these dynamic divs to survive a page
refresh? Maybe on the a 'wicket-example'?

Thanks,

-Luther

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



Re: refresh page

2009-06-11 Thread Luther Baker
I think you're right - I would need to use the Session or the Database on
each Ajax invocation to add these values.

But it also seems that if I store the new, dynamic, page specific values
into a TextField (as opposed to a div) - they survive a page refresh. I'm
not sure if that is robust or formally a standard across all browsers - so I
will do a bit more research but that seems to be the behavior I'm after.

Thanks,

-Luther



2009/6/11 Dorothée Giernoth dorothee.giern...@kds-kg.de

 Hmm, is that possible ... you can't like store session-data in the browser,
 do you? You can only store session-details in the database on the fly with
 ajax while the user still fills out the form to allow the user to re-create
 the session on next login or something like this if he accidently hits
 reload (but even then I am not sure if that works ... maybe if you write the
 not yet submitted but in the form included information back into the fields
 when the site is rendered) ...

 Does that make sense ... or I am not understanding the question ;)

 - dg


 -Ursprüngliche Nachricht-
 Von: Luther Baker [mailto:lutherba...@gmail.com]
 Gesendet: Donnerstag, 11. Juni 2009 13:27
 An: users@wicket.apache.org
 Betreff: refresh page

 If I add a few values to a page div ala an Ajax button - and the user hits
 refresh on the page, the new values I've added go away.

 The user is completing a form - but hasn't formally submitted the form yet
 -
 so there is nothing stored in the database yet. The browser naturally
 re-renders the textarea and input values to the screen - but wipes out
 content to any divs I might have dynamically added data to.

 What would be the wicket way to allow these dynamic divs to survive a
 page
 refresh? Maybe on the a 'wicket-example'?

 Thanks,

 -Luther

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




Re: refresh page

2009-06-11 Thread Luther Baker
So it turns out I'm going to want to display these values as a list ul ...
li etc. My 'input' approach won't be adequate.

Back to the Session idea ... (smells already).

WIA has a security chapter that goes into storing a User in session - but
does anyone have a good resource that dives a bit deeper into best practices
with respect to Sessions? What about logical concepts/scopes like request,
flash, conversational, etc - and how wicket facilitates them?

Eg: I'd like to accumulate/remember page specific things while the user is
visits a particular url. Ideally, the transient info is dropped when the
user navigates away. I could create a POJO that represents the info and add
getters and setters to the wicket session object I extended from the WIA
security chapter ... but that smells bad. It seems heavy --- and I'm not
sure it makes sense to use that pattern everywhere I have Ajax buttons
putting rendering new values to the screen. Is there a more generalize
Wicket mechanism for this type of thing?

A localized, managed, short term, minimal, user specific, page specific type
of state management?

Or, given my issue, is there another way to think of this (out of box)?
Again, I am user's adding a few values (tags, categories) to the screen with
Ajax buttons and I need to make sure that information survives browser
behaviors like page refreshes.

Thanks,

-Luther




On Thu, Jun 11, 2009 at 7:07 AM, Luther Baker lutherba...@gmail.com wrote:

 I think you're right - I would need to use the Session or the Database on
 each Ajax invocation to add these values.

 But it also seems that if I store the new, dynamic, page specific values
 into a TextField (as opposed to a div) - they survive a page refresh. I'm
 not sure if that is robust or formally a standard across all browsers - so I
 will do a bit more research but that seems to be the behavior I'm after.

 Thanks,

 -Luther



 2009/6/11 Dorothée Giernoth dorothee.giern...@kds-kg.de

 Hmm, is that possible ... you can't like store session-data in the browser,
 do you? You can only store session-details in the database on the fly with
 ajax while the user still fills out the form to allow the user to re-create
 the session on next login or something like this if he accidently hits
 reload (but even then I am not sure if that works ... maybe if you write the
 not yet submitted but in the form included information back into the fields
 when the site is rendered) ...

 Does that make sense ... or I am not understanding the question ;)

 - dg


 -Ursprüngliche Nachricht-
 Von: Luther Baker [mailto:lutherba...@gmail.com]
 Gesendet: Donnerstag, 11. Juni 2009 13:27
 An: users@wicket.apache.org
 Betreff: refresh page

 If I add a few values to a page div ala an Ajax button - and the user
 hits
 refresh on the page, the new values I've added go away.

 The user is completing a form - but hasn't formally submitted the form yet
 -
 so there is nothing stored in the database yet. The browser naturally
 re-renders the textarea and input values to the screen - but wipes out
 content to any divs I might have dynamically added data to.

 What would be the wicket way to allow these dynamic divs to survive a
 page
 refresh? Maybe on the a 'wicket-example'?

 Thanks,

 -Luther

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





AW: refresh page

2009-06-11 Thread Dorothée Giernoth

I dunno if I understand correctly, but how about constantly saving a 
session-state user-specific in a database as soon as a component loses the 
focus? If the site is refreshed, the session-id would be still valid and the 
pre-refresh-session-state can be loaded?
After the user logs out correctly you can set a flag to true, to mark the 
session as completed ... if for a reason the user is not logged out in a yes, 
I would like to leave and please save my changes-way, this flag would not be 
changed and saved for the user in the database. The user could reload the 
session after he re-logs in as his changes are saved.
Dunno if that would be an acceptable approach or if that helps you at all.

- dg
 
 

-Ursprüngliche Nachricht-
Von: Luther Baker [mailto:lutherba...@gmail.com] 
Gesendet: Donnerstag, 11. Juni 2009 15:22
An: users@wicket.apache.org
Betreff: Re: refresh page

So it turns out I'm going to want to display these values as a list ul ...
li etc. My 'input' approach won't be adequate.

Back to the Session idea ... (smells already).

WIA has a security chapter that goes into storing a User in session - but
does anyone have a good resource that dives a bit deeper into best practices
with respect to Sessions? What about logical concepts/scopes like request,
flash, conversational, etc - and how wicket facilitates them?

Eg: I'd like to accumulate/remember page specific things while the user is
visits a particular url. Ideally, the transient info is dropped when the
user navigates away. I could create a POJO that represents the info and add
getters and setters to the wicket session object I extended from the WIA
security chapter ... but that smells bad. It seems heavy --- and I'm not
sure it makes sense to use that pattern everywhere I have Ajax buttons
putting rendering new values to the screen. Is there a more generalize
Wicket mechanism for this type of thing?

A localized, managed, short term, minimal, user specific, page specific type
of state management?

Or, given my issue, is there another way to think of this (out of box)?
Again, I am user's adding a few values (tags, categories) to the screen with
Ajax buttons and I need to make sure that information survives browser
behaviors like page refreshes.

Thanks,

-Luther




On Thu, Jun 11, 2009 at 7:07 AM, Luther Baker lutherba...@gmail.com wrote:

 I think you're right - I would need to use the Session or the Database on
 each Ajax invocation to add these values.

 But it also seems that if I store the new, dynamic, page specific values
 into a TextField (as opposed to a div) - they survive a page refresh. I'm
 not sure if that is robust or formally a standard across all browsers - so I
 will do a bit more research but that seems to be the behavior I'm after.

 Thanks,

 -Luther



 2009/6/11 Dorothée Giernoth dorothee.giern...@kds-kg.de

 Hmm, is that possible ... you can't like store session-data in the browser,
 do you? You can only store session-details in the database on the fly with
 ajax while the user still fills out the form to allow the user to re-create
 the session on next login or something like this if he accidently hits
 reload (but even then I am not sure if that works ... maybe if you write the
 not yet submitted but in the form included information back into the fields
 when the site is rendered) ...

 Does that make sense ... or I am not understanding the question ;)

 - dg


 -Ursprüngliche Nachricht-
 Von: Luther Baker [mailto:lutherba...@gmail.com]
 Gesendet: Donnerstag, 11. Juni 2009 13:27
 An: users@wicket.apache.org
 Betreff: refresh page

 If I add a few values to a page div ala an Ajax button - and the user
 hits
 refresh on the page, the new values I've added go away.

 The user is completing a form - but hasn't formally submitted the form yet
 -
 so there is nothing stored in the database yet. The browser naturally
 re-renders the textarea and input values to the screen - but wipes out
 content to any divs I might have dynamically added data to.

 What would be the wicket way to allow these dynamic divs to survive a
 page
 refresh? Maybe on the a 'wicket-example'?

 Thanks,

 -Luther

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




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



Re: refresh page

2009-06-11 Thread Michael O'Cleirigh

Hi Luther,

If I add a few values to a page div ala an Ajax button - and the user hits
refresh on the page, the new values I've added go away.

The user is completing a form - but hasn't formally submitted the form yet -
so there is nothing stored in the database yet. The browser naturally
re-renders the textarea and input values to the screen - but wipes out
content to any divs I might have dynamically added data to.

  
There is a DOM event on 'unload' on the body tag that can be used to 
notify the user about what will happen in this case; i.e. they will lose 
the data they have entered if they refresh.


Have a look at ModalWindow since it implements an unload event for just 
this case.


It seems like you should be able to add an AttributeModifier on the body 
tag and then craft an interface where you particular component can 
contribute a javascript callback to the main unload callback maybe via 
an IModelString.


Another option if your forms are small enough is to just push an ajax 
get request with customized parameters or 
AjaxFormComponentUpdatingBehavior when the data is changed (i.e. bind 
the callback to the 'onblur' event) This will populate the server side 
models and allow a rerender to work properly.


Regards,

Mike



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



Re: refresh page

2009-06-11 Thread Nicolas Melendez
Hi, i would use the Session, but also use it as a Context. Context should be
coded.
So you use the context in your page, and the context use the Session to
store data.
I don't think using the database is good idea.

NM




2009/6/11 Dorothée Giernoth dorothee.giern...@kds-kg.de


 I dunno if I understand correctly, but how about constantly saving a
 session-state user-specific in a database as soon as a component loses the
 focus? If the site is refreshed, the session-id would be still valid and the
 pre-refresh-session-state can be loaded?
 After the user logs out correctly you can set a flag to true, to mark the
 session as completed ... if for a reason the user is not logged out in a
 yes, I would like to leave and please save my changes-way, this flag would
 not be changed and saved for the user in the database. The user could reload
 the session after he re-logs in as his changes are saved.
 Dunno if that would be an acceptable approach or if that helps you at all.

 - dg



 -Ursprüngliche Nachricht-
 Von: Luther Baker [mailto:lutherba...@gmail.com]
 Gesendet: Donnerstag, 11. Juni 2009 15:22
 An: users@wicket.apache.org
 Betreff: Re: refresh page

 So it turns out I'm going to want to display these values as a list ul
 ...
 li etc. My 'input' approach won't be adequate.

 Back to the Session idea ... (smells already).

 WIA has a security chapter that goes into storing a User in session - but
 does anyone have a good resource that dives a bit deeper into best
 practices
 with respect to Sessions? What about logical concepts/scopes like request,
 flash, conversational, etc - and how wicket facilitates them?

 Eg: I'd like to accumulate/remember page specific things while the user is
 visits a particular url. Ideally, the transient info is dropped when the
 user navigates away. I could create a POJO that represents the info and add
 getters and setters to the wicket session object I extended from the WIA
 security chapter ... but that smells bad. It seems heavy --- and I'm not
 sure it makes sense to use that pattern everywhere I have Ajax buttons
 putting rendering new values to the screen. Is there a more generalize
 Wicket mechanism for this type of thing?

 A localized, managed, short term, minimal, user specific, page specific
 type
 of state management?

 Or, given my issue, is there another way to think of this (out of box)?
 Again, I am user's adding a few values (tags, categories) to the screen
 with
 Ajax buttons and I need to make sure that information survives browser
 behaviors like page refreshes.

 Thanks,

 -Luther




 On Thu, Jun 11, 2009 at 7:07 AM, Luther Baker lutherba...@gmail.com
 wrote:

  I think you're right - I would need to use the Session or the Database on
  each Ajax invocation to add these values.
 
  But it also seems that if I store the new, dynamic, page specific values
  into a TextField (as opposed to a div) - they survive a page refresh. I'm
  not sure if that is robust or formally a standard across all browsers -
 so I
  will do a bit more research but that seems to be the behavior I'm after.
 
  Thanks,
 
  -Luther
 
 
 
  2009/6/11 Dorothée Giernoth dorothee.giern...@kds-kg.de
 
  Hmm, is that possible ... you can't like store session-data in the
 browser,
  do you? You can only store session-details in the database on the fly
 with
  ajax while the user still fills out the form to allow the user to
 re-create
  the session on next login or something like this if he accidently hits
  reload (but even then I am not sure if that works ... maybe if you write
 the
  not yet submitted but in the form included information back into the
 fields
  when the site is rendered) ...
 
  Does that make sense ... or I am not understanding the question ;)
 
  - dg
 
 
  -Ursprüngliche Nachricht-
  Von: Luther Baker [mailto:lutherba...@gmail.com]
  Gesendet: Donnerstag, 11. Juni 2009 13:27
  An: users@wicket.apache.org
  Betreff: refresh page
 
  If I add a few values to a page div ala an Ajax button - and the user
  hits
  refresh on the page, the new values I've added go away.
 
  The user is completing a form - but hasn't formally submitted the form
 yet
  -
  so there is nothing stored in the database yet. The browser naturally
  re-renders the textarea and input values to the screen - but wipes out
  content to any divs I might have dynamically added data to.
 
  What would be the wicket way to allow these dynamic divs to survive a
  page
  refresh? Maybe on the a 'wicket-example'?
 
  Thanks,
 
  -Luther
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

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




Re: refresh page

2009-06-11 Thread Igor Vaynberg
sounds like ajax mods to a bookmarkable page...

mount the page with hybridurlcodingstrategy and your problems will go away.

-igor

On Thu, Jun 11, 2009 at 4:26 AM, Luther Bakerlutherba...@gmail.com wrote:
 If I add a few values to a page div ala an Ajax button - and the user hits
 refresh on the page, the new values I've added go away.

 The user is completing a form - but hasn't formally submitted the form yet -
 so there is nothing stored in the database yet. The browser naturally
 re-renders the textarea and input values to the screen - but wipes out
 content to any divs I might have dynamically added data to.

 What would be the wicket way to allow these dynamic divs to survive a page
 refresh? Maybe on the a 'wicket-example'?

 Thanks,

 -Luther


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



Refresh page after downloading file

2009-05-26 Thread Humberto N. Castejon Martinez
Hi!

I have a page with several links to download files. After one file is
downloaded I would like the corresponding link to dissapear from the page.
In principle this would be as simple as refreshing the page once a link has
been clicked. However, I am not sure how to do this, since using
setResponsePage() in the link's onClick() method does not give the desired
result (instead of the file being downloaded it is the html file of the page
set as response that is downloaded). I would really appreciate if you could
help me with this. Thanks a lot.

Cheers,
Humberto


AW: Refresh page after downloading file

2009-05-26 Thread Dorothée Giernoth
How about setting the visibility to false 
(yourComponentOrLink.setVisibility(false);) on click or something.
Dunno if it works with links as well, but should if it is bound to a wicket-id 
... 



-Ursprüngliche Nachricht-
Von: humberto.castejon.marti...@gmail.com 
[mailto:humberto.castejon.marti...@gmail.com] Im Auftrag von Humberto N. 
Castejon Martinez
Gesendet: Dienstag, 26. Mai 2009 12:08
An: users@wicket.apache.org
Betreff: Refresh page after downloading file

Hi!

I have a page with several links to download files. After one file is
downloaded I would like the corresponding link to dissapear from the page.
In principle this would be as simple as refreshing the page once a link has
been clicked. However, I am not sure how to do this, since using
setResponsePage() in the link's onClick() method does not give the desired
result (instead of the file being downloaded it is the html file of the page
set as response that is downloaded). I would really appreciate if you could
help me with this. Thanks a lot.

Cheers,
Humberto

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



Re: refresh page with detachable model - not working

2008-09-23 Thread lienok

Well, I found my problem.

of course the model was changed but it did not have a chance to show,
because I didn't call the method setVisibility() where changes are visible.

so I add to every click
. 
lnkSendToAuth = new Link(sendToAuth) {

public void onClick() {
   /**
 *after ticket is authorized link sendToAuth is disabled
 * BUT THIS IS NOT WORKING AUTOMATICALLY,
 * I have to reopen the page. NOT EVEN REFRESH IS HELPING */

tck.sendToAuthorization(true);
info(Ticket was sent to authorization.);
}

setVisibility();
};
add(lnkSendToAuth); 


anyway thank you for the assistance :)  
at least I knew there was no problem with models.. 


lienok wrote:
 
 Hi Marijn, 
 
 I have moved it to the onclick handler in a following way, but it did not
 help.
 tck = (Ticket) getParent().getModel().getObject();
 
 
 
 
 Martijn Dashorst wrote:
 
 move tck = getModelObject() into the onclick handler.
 
 Martijn
 
 On Mon, Sep 22, 2008 at 4:05 PM, lienok [EMAIL PROTECTED] wrote:

 Hello,

 the panel with detachable model is not refreshing after model has
 changed.
 kindly check the code please.

 the panel - ActivityPanel is not refreshing after I press link and
 status of
 the DetachableTcktModel is changed.

 public LoansTabPanel(String id, int ticketId) {
super(id);
setModel(new CompoundPropertyModel(new
 DetachableTcktModel(ticketId)));
getMenu();
getFullContent();
 }

 public void getFullContent() {

//when ticket was not authorized sendToAuth link is visible
add(new ActivityPanel(activityPanel, getModel()));
}

 ..

 public ActivityPanel(String id, IModel model) {
super(id, model);
tck = (Ticket) getModelObject();

lnkSendToAuth = new Link(sendToAuth) {

public void onClick() {
   /**
 *after ticket is authorized link sendToAuth is disabled
 * BUT THIS IS NOT WORKING AUTOMATICALLY,
 * I have to reopen the page. NOT EVEN REFRESH IS HELPING */

tck.sendToAuthorization(true);
info(Ticket was sent to authorization.);
}
};
add(lnkSendToAuth);

 }
 
 public DetachableTcktModel(int ticketID) {
this.ticketId = ticketID;
 }

 protected Object load() {
tck = findTicket(ticketId);
return tck;
 }

 public void detach() {
tck = null;
}

 .


 Any advice what I am doing wrong I would appreciate.

 Thanks, Lenka

 --
 View this message in context:
 http://www.nabble.com/refresh-page-with-detachable-model---not-working-tp19608631p19608631.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 
 
 -- 
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/refresh-page-with-detachable-model---not-working-tp19608631p19625525.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



refresh page with detachable model - not working

2008-09-22 Thread lienok

Hello, 

the panel with detachable model is not refreshing after model has changed.
kindly check the code please.

the panel - ActivityPanel is not refreshing after I press link and status of
the DetachableTcktModel is changed.

public LoansTabPanel(String id, int ticketId) {
super(id);
setModel(new CompoundPropertyModel(new
DetachableTcktModel(ticketId)));
getMenu();
getFullContent();
}

public void getFullContent() {

//when ticket was not authorized sendToAuth link is visible
add(new ActivityPanel(activityPanel, getModel()));   
}

..

public ActivityPanel(String id, IModel model) {
super(id, model);   
tck = (Ticket) getModelObject(); 

lnkSendToAuth = new Link(sendToAuth) {

public void onClick() {
   /**
 *after ticket is authorized link sendToAuth is disabled 
 * BUT THIS IS NOT WORKING AUTOMATICALLY, 
 * I have to reopen the page. NOT EVEN REFRESH IS HELPING */

tck.sendToAuthorization(true);  
info(Ticket was sent to authorization.);
}
};
add(lnkSendToAuth);

}
 
public DetachableTcktModel(int ticketID) {
this.ticketId = ticketID;
}

protected Object load() {
tck = findTicket(ticketId);
return tck;
}

public void detach() {
tck = null;
}

.


Any advice what I am doing wrong I would appreciate.

Thanks, Lenka

-- 
View this message in context: 
http://www.nabble.com/refresh-page-with-detachable-model---not-working-tp19608631p19608631.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: refresh page with detachable model - not working

2008-09-22 Thread Martijn Dashorst
move tck = getModelObject() into the onclick handler.

Martijn

On Mon, Sep 22, 2008 at 4:05 PM, lienok [EMAIL PROTECTED] wrote:

 Hello,

 the panel with detachable model is not refreshing after model has changed.
 kindly check the code please.

 the panel - ActivityPanel is not refreshing after I press link and status of
 the DetachableTcktModel is changed.

 public LoansTabPanel(String id, int ticketId) {
super(id);
setModel(new CompoundPropertyModel(new
 DetachableTcktModel(ticketId)));
getMenu();
getFullContent();
 }

 public void getFullContent() {

//when ticket was not authorized sendToAuth link is visible
add(new ActivityPanel(activityPanel, getModel()));
}

 ..

 public ActivityPanel(String id, IModel model) {
super(id, model);
tck = (Ticket) getModelObject();

lnkSendToAuth = new Link(sendToAuth) {

public void onClick() {
   /**
 *after ticket is authorized link sendToAuth is disabled
 * BUT THIS IS NOT WORKING AUTOMATICALLY,
 * I have to reopen the page. NOT EVEN REFRESH IS HELPING */

tck.sendToAuthorization(true);
info(Ticket was sent to authorization.);
}
};
add(lnkSendToAuth);

 }
 
 public DetachableTcktModel(int ticketID) {
this.ticketId = ticketID;
 }

 protected Object load() {
tck = findTicket(ticketId);
return tck;
 }

 public void detach() {
tck = null;
}

 .


 Any advice what I am doing wrong I would appreciate.

 Thanks, Lenka

 --
 View this message in context: 
 http://www.nabble.com/refresh-page-with-detachable-model---not-working-tp19608631p19608631.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: refresh page with detachable model - not working

2008-09-22 Thread lienok

Hi Marijn, 

I have moved it to the onclick handler in a following way, but it did not
help.
tck = (Ticket) getParent().getModel().getObject();




Martijn Dashorst wrote:
 
 move tck = getModelObject() into the onclick handler.
 
 Martijn
 
 On Mon, Sep 22, 2008 at 4:05 PM, lienok [EMAIL PROTECTED] wrote:

 Hello,

 the panel with detachable model is not refreshing after model has
 changed.
 kindly check the code please.

 the panel - ActivityPanel is not refreshing after I press link and status
 of
 the DetachableTcktModel is changed.

 public LoansTabPanel(String id, int ticketId) {
super(id);
setModel(new CompoundPropertyModel(new
 DetachableTcktModel(ticketId)));
getMenu();
getFullContent();
 }

 public void getFullContent() {

//when ticket was not authorized sendToAuth link is visible
add(new ActivityPanel(activityPanel, getModel()));
}

 ..

 public ActivityPanel(String id, IModel model) {
super(id, model);
tck = (Ticket) getModelObject();

lnkSendToAuth = new Link(sendToAuth) {

public void onClick() {
   /**
 *after ticket is authorized link sendToAuth is disabled
 * BUT THIS IS NOT WORKING AUTOMATICALLY,
 * I have to reopen the page. NOT EVEN REFRESH IS HELPING */

tck.sendToAuthorization(true);
info(Ticket was sent to authorization.);
}
};
add(lnkSendToAuth);

 }
 
 public DetachableTcktModel(int ticketID) {
this.ticketId = ticketID;
 }

 protected Object load() {
tck = findTicket(ticketId);
return tck;
 }

 public void detach() {
tck = null;
}

 .


 Any advice what I am doing wrong I would appreciate.

 Thanks, Lenka

 --
 View this message in context:
 http://www.nabble.com/refresh-page-with-detachable-model---not-working-tp19608631p19608631.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 
 
 -- 
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/refresh-page-with-detachable-model---not-working-tp19608631p19609156.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Refresh page vs Restart to see HTML changes

2007-09-17 Thread Doug Leeper

I was under the impression that I would be able to change HTML while the
server was running and see it reflected when I refreshed the browser.   
Unfortunately, I have to restart the entire server to see the change.  If my
understanding is correct, what could I be doing wrong?


Notes:
- I am starting Jetty 4.2.24 from Eclipse 3.3.  
- I checked to see if I have my Wicket Application is running in development
mode and it is. 
- I am using wicket 1.3 beta3.  
- My html files are located in the same directory as my components.
- I am setting meta http-equiv=CACHE-CONTROL content=NO-CACHE /
meta http-equiv=PRAGMA content=NO-CACHE /

Thanks
- Doug


-- 
View this message in context: 
http://www.nabble.com/Refresh-page-vs-Restart-to-see-HTML-changes-tf4469520.html#a12743603
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Refresh page vs Restart to see HTML changes

2007-09-17 Thread Martijn Dashorst
Are the files copied from the sources directory to the classes
directory? By default eclipse doesn't copy those files to the
classpath iirc.

Martijn

On 9/17/07, Doug Leeper [EMAIL PROTECTED] wrote:

 I was under the impression that I would be able to change HTML while the
 server was running and see it reflected when I refreshed the browser.
 Unfortunately, I have to restart the entire server to see the change.  If my
 understanding is correct, what could I be doing wrong?


 Notes:
 - I am starting Jetty 4.2.24 from Eclipse 3.3.
 - I checked to see if I have my Wicket Application is running in development
 mode and it is.
 - I am using wicket 1.3 beta3.
 - My html files are located in the same directory as my components.
 - I am setting meta http-equiv=CACHE-CONTROL content=NO-CACHE /
 meta http-equiv=PRAGMA content=NO-CACHE /

 Thanks
 - Doug


 --
 View this message in context: 
 http://www.nabble.com/Refresh-page-vs-Restart-to-see-HTML-changes-tf4469520.html#a12743603
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Refresh page vs Restart to see HTML changes

2007-09-17 Thread Doug Leeper

My files are being compiled/copied to iirc/bin.  Any configuration settings I
need to adjust to get this to work?


How did you create your project? Using the quickstart archetype?

I'm not sure where your eclipse compiles your Java sources to. With
normal Eclipse use, that is iirc /bin If you use maven to generate
your project using mvn eclipse:eclipse, then it will be under
/target/classes

In the particular location for your setup, the html should be copied
there as well.

Martijn

-- 
View this message in context: 
http://www.nabble.com/Refresh-page-vs-Restart-to-see-HTML-changes-tf4469520.html#a12744116
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Refresh page vs Restart to see HTML changes

2007-09-17 Thread Doug Leeper

I am running in development mode.  The console shows DEVELOPMENT upon
startup.


Make sure you run in development mode. E.g. pass
-Dwicket.configuration=development or configure in your web.xml file.

Eelco

-- 
View this message in context: 
http://www.nabble.com/Refresh-page-vs-Restart-to-see-HTML-changes-tf4469520.html#a12743871
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Refresh page vs Restart to see HTML changes

2007-09-17 Thread Martijn Dashorst
On 9/17/07, Eelco Hillenius [EMAIL PROTECTED] wrote:
 Eclipse does. Maven for instance doesn't.

Are you sure the maven eclipse:eclipse doesn't generate the auto
copying of HTML files for you when you add the src/main/java as a
resources directory in your pom, such as our quickstart archetype and
quickstart project does?

Each time I create a project from scratch using the normal eclipse
wizards, I have to add HTML file copying. This is mainly because
usually html next to Java classes is associated with JavaDoc and that
typically doesn't have a place in applications.

Martijn

-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Refresh page vs Restart to see HTML changes

2007-09-17 Thread Eelco Hillenius
 Are you sure the maven eclipse:eclipse doesn't generate the auto
 copying of HTML files for you when you add the src/main/java as a
 resources directory in your pom, such as our quickstart archetype and
 quickstart project does?

Yep, I'm sure. Eclipse copies files by default, but you can configure
it to filter (skip) certain files.

 Each time I create a project from scratch using the normal eclipse
 wizards, I have to add HTML file copying. This is mainly because
 usually html next to Java classes is associated with JavaDoc and that
 typically doesn't have a place in applications.

You should revisit that. To be absolutely sure I just created a test
project with a class and html file, and the html file got copied to
the class path without any explicit configuration.

Eelco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Refresh page vs Restart to see HTML changes

2007-09-17 Thread Eelco Hillenius
On 9/17/07, Martijn Dashorst [EMAIL PROTECTED] wrote:
 Are the files copied from the sources directory to the classes
 directory? By default eclipse doesn't copy those files to the
 classpath iirc.

Eclipse does. Maven for instance doesn't.

Eelco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Refresh page vs Restart to see HTML changes

2007-09-17 Thread Martijn Dashorst
And what do you see in the logs? Are there no exceptions?

Martijn

On 9/17/07, Martijn Dashorst [EMAIL PROTECTED] wrote:
 Are the files copied from the sources directory to the classes
 directory? By default eclipse doesn't copy those files to the
 classpath iirc.

 Martijn

 On 9/17/07, Doug Leeper [EMAIL PROTECTED] wrote:
 
  I was under the impression that I would be able to change HTML while the
  server was running and see it reflected when I refreshed the browser.
  Unfortunately, I have to restart the entire server to see the change.  If my
  understanding is correct, what could I be doing wrong?
 
 
  Notes:
  - I am starting Jetty 4.2.24 from Eclipse 3.3.
  - I checked to see if I have my Wicket Application is running in development
  mode and it is.
  - I am using wicket 1.3 beta3.
  - My html files are located in the same directory as my components.
  - I am setting meta http-equiv=CACHE-CONTROL content=NO-CACHE /
  meta http-equiv=PRAGMA content=NO-CACHE /
 
  Thanks
  - Doug
 
 
  --
  View this message in context: 
  http://www.nabble.com/Refresh-page-vs-Restart-to-see-HTML-changes-tf4469520.html#a12743603
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


 --
 Buy Wicket in Action: http://manning.com/dashorst
 Apache Wicket 1.3.0-beta3 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/



-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Refresh page vs Restart to see HTML changes

2007-09-17 Thread Doug Leeper

When you say  copy to the classes directory, I am assuming you mean the
WEB-INF/classes.  If that is the case...then no.  The classpath for the
start application refers to the source code directory.

Do I need to have Eclipse copy this files to WEB-INF/classes?  If so, how do
I go about doing that?  I am an Eclipse novice (I got up and running based
on the quick start tutorial but varying from that I am useless lost)

Thanks
- Doug


Martijn Dashorst wrote:
 
 Are the files copied from the sources directory to the classes
 directory? By default eclipse doesn't copy those files to the
 classpath iirc.
 
 Martijn
 
 On 9/17/07, Doug Leeper [EMAIL PROTECTED] wrote:

 I was under the impression that I would be able to change HTML while the
 server was running and see it reflected when I refreshed the browser.
 Unfortunately, I have to restart the entire server to see the change.  If
 my
 understanding is correct, what could I be doing wrong?


 Notes:
 - I am starting Jetty 4.2.24 from Eclipse 3.3.
 - I checked to see if I have my Wicket Application is running in
 development
 mode and it is.
 - I am using wicket 1.3 beta3.
 - My html files are located in the same directory as my components.
 - I am setting meta http-equiv=CACHE-CONTROL content=NO-CACHE /
 meta http-equiv=PRAGMA content=NO-CACHE /

 Thanks
 - Doug


 --
 View this message in context:
 http://www.nabble.com/Refresh-page-vs-Restart-to-see-HTML-changes-tf4469520.html#a12743603
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 
 -- 
 Buy Wicket in Action: http://manning.com/dashorst
 Apache Wicket 1.3.0-beta3 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Refresh-page-vs-Restart-to-see-HTML-changes-tf4469520.html#a12743870
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Refresh page vs Restart to see HTML changes

2007-09-17 Thread Doug Leeper

That was it.  I somehow had the wrong jars (1.3.x) mix with 1.4.

Thanks!  Productivity will go no go up!!!



Martijn Dashorst wrote:
 
 On 9/17/07, Doug Leeper [EMAIL PROTECTED] wrote:
 My files are being compiled/copied to iirc/bin.  Any configuration
 settings I
 need to adjust to get this to work?
 
 Typically it should work this way. I don't see anything wrong with this
 setup.
 
 There is the possibility of a wrong SLF4J dependency. Make sure you
 have the versions ligned up correctly (there is a nasty version
 descrepency in the quickstart archetype). For beta3 you'd need
 slf4j-api-1.4 and the corresponding slf4j-impl-1.4 jars (impl can be
 log4j for instance).
 
 

-- 
View this message in context: 
http://www.nabble.com/Refresh-page-vs-Restart-to-see-HTML-changes-tf4469520.html#a12748950
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]