SV: page refresh cleans my page state

2008-11-24 Thread Singh Mukesh
Hi 

I have gone through the HybridUrlCodingStrategy. The HybridUrlCodingStrategy is 
working porperly in WebApplication but not in portal environment. In 
WebApplication it retain the page state but not in portal environment.

Please suggest what should I do in portal environment.

Thanks in advance.
 


Med vennlig hilsen

MUKESH SINGH
CAPGEMINI Consultant
Arrive AS
T (+47) 46 47 90 16
E-post: [EMAIL PROTECTED]



-Opprinnelig melding-
Fra: jWeekend [mailto:[EMAIL PROTECTED] 
Sendt: 20 November 2008 14:25
Til: users@wicket.apache.org
Emne: Re: page refresh cleans my page state


Singh,

Take a look at  http://cwiki.apache.org/WICKET/url-coding-strategies.html
HybridUrlCodingStrategy .

Regards - Cemal
http://www.jWeekend.co.uk http://jWeekend.co.uk 


Singh Mukesh wrote:
 
 
 Hi,
 
 I am using wicket. I have a page with one links which increase the 
 counter value based on user click on the link, for all these actions I 
 am using Ajax. For instance user click 5 times on link the counter shows 
 value 5.
 It is ok but if I click on browsers refresh button all changes are 
 lost and it shows the counter value 0 instead of 5. How to handle the 
 refresh button?
 
 Please find the code below.
 
 TestPage.java
 
 import org.apache.wicket.PageParameters; import 
 org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
 import org.apache.wicket.ajax.markup.html.form.AjaxCheckBox;
 import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.model.IModel; import 
 org.apache.wicket.model.Model;
 
 public class TestPage extends WebPage {
   
   public TestPage(PageParameters parameters) {
   super(parameters);
   final ModelInteger modell = new ModelInteger(new 
 Integer(0));
   // Slik at telleverdien legges i session
   setDefaultModel(modell);
   final Label telleLabel = new Label(teller, modell);
   telleLabel.setOutputMarkupId(true);
   final Label hashcodeLabel = new Label(hashcode, new 
 IModelString() {
   private static final long serialVersionUID = 1L;
 
   public String getObject() {
   return 
 String.valueOf(System.identityHashCode(TestPage.this));
   }
 
   public void setObject(String object) {
   /* NOOP */
   }
 
   public void detach() {
   /* NOOP */
   }
   
   });
   hashcodeLabel.setOutputMarkupId(true);
   add(telleLabel);
   add(new AjaxLinkInteger(link, modell) {
   private static final long serialVersionUID = 1L;
 
   @Override
   public void onClick(AjaxRequestTarget target) {
   // Øk det delte modellobjektet
   Integer tall = getModelObject();
   int verdi = tall.intValue() + 1;
   tall = new Integer(verdi);
   setModelObject(tall);
   // Fortell klienten hvilken komponent som skal 
 oppdateres
   target.addComponent(telleLabel);
   target.addComponent(hashcodeLabel);
   }   
   });
   add(hashcodeLabel);
   add(new AjaxCheckBox(versioned, new 
 ModelBoolean(Boolean.TRUE)) {
   private static final long serialVersionUID = 1L;
 
   @Override
   protected void onUpdate(AjaxRequestTarget target) {
   
 setVersioned(this.getModelObject().booleanValue());
   }
   
   });
   setVersioned(true);
   }
   
   
 
   
 }
 
 
 
 TestApplication.java
 
 import org.apache.wicket.Page;
 import org.apache.wicket.Request;
 import org.apache.wicket.Response;
 import org.apache.wicket.Session;
 import org.apache.wicket.protocol.http.WebApplication;
 
 public class TestApplication extends WebApplication {
 
   @Override
   public Class? extends Page getHomePage() {
   return TestPage.class;
   }
   
 }
 
 TestPage.html
 
 html
   xmlns=http://www.w3.org/1999/xhtml;  
   xmlns:wicket=http://wicket.apache.org/;
 !-- Basis-side som inneholder navigasjonssti --
   head
   titleTestside/title
 /head
 body
# + nbsp;0
   p class=portlet-fontDenne portleten har hashCode lik 34563./p
   p class=portlet-fontinput type=checkbox 
 class=portlet-form-field
 wicket:id=versioned Versjonert/p
 /body
 /html
 
 
 Please suggest me the way how to handle the refresh

page refresh cleans my page state

2008-11-20 Thread Singh Mukesh

Hi,

I am using wicket. I have a page with one links which increase the counter 
value based on user click on the link, for all these actions I am using Ajax. 
For instance user click 5 times on link the counter shows value 5. It is ok but 
if I click on browsers refresh button all changes are lost and it shows the 
counter value 0 instead of 5. How to handle the refresh button?

Please find the code below.

TestPage.java

import org.apache.wicket.PageParameters;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxCheckBox;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

public class TestPage extends WebPage {

public TestPage(PageParameters parameters) {
super(parameters);
final ModelInteger modell = new ModelInteger(new 
Integer(0));
// Slik at telleverdien legges i session
setDefaultModel(modell);
final Label telleLabel = new Label(teller, modell);
telleLabel.setOutputMarkupId(true);
final Label hashcodeLabel = new Label(hashcode, new 
IModelString() {
private static final long serialVersionUID = 1L;

public String getObject() {
return 
String.valueOf(System.identityHashCode(TestPage.this));
}

public void setObject(String object) {
/* NOOP */
}

public void detach() {
/* NOOP */
}

});
hashcodeLabel.setOutputMarkupId(true);
add(telleLabel);
add(new AjaxLinkInteger(link, modell) {
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
// Øk det delte modellobjektet
Integer tall = getModelObject();
int verdi = tall.intValue() + 1;
tall = new Integer(verdi);
setModelObject(tall);
// Fortell klienten hvilken komponent som skal 
oppdateres
target.addComponent(telleLabel);
target.addComponent(hashcodeLabel);
}   
});
add(hashcodeLabel);
add(new AjaxCheckBox(versioned, new 
ModelBoolean(Boolean.TRUE)) {
private static final long serialVersionUID = 1L;

@Override
protected void onUpdate(AjaxRequestTarget target) {

setVersioned(this.getModelObject().booleanValue());
}

});
setVersioned(true);
}




}



TestApplication.java

import org.apache.wicket.Page;
import org.apache.wicket.Request;
import org.apache.wicket.Response;
import org.apache.wicket.Session;
import org.apache.wicket.protocol.http.WebApplication;

public class TestApplication extends WebApplication {

@Override
public Class? extends Page getHomePage() {
return TestPage.class;
}

}

TestPage.html 

html
  xmlns=http://www.w3.org/1999/xhtml;  
  xmlns:wicket=http://wicket.apache.org/;
!-- Basis-side som inneholder navigasjonssti --
head
titleTestside/title
/head
body
a href=# style=font: bold 12pt 'Arial' 
wicket:id=link+/anbsp;span wicket:id=teller0/span
p class=portlet-fontDenne portleten har hashCode lik b 
wicket:id=hashcode34563/b./p
p class=portlet-fontinput type=checkbox 
class=portlet-form-field wicket:id=versioned span 
class=portlet-form-labelVersjonert/span/p
/body
/html


Please suggest me the way how to handle the refresh button problem.

Please do the needful.


Med vennlig hilsen

MUKESH SINGH
CAPGEMINI Consultant
Arrive AS
T (+47) 46 47 90 16
E-post: [EMAIL PROTECTED]
http://servicedesk.arrive.no




how to navigate from edit mode to view mode

2008-09-29 Thread Singh Mukesh
Hi

I have created a bookmark portlet using wicket. And the bookmark portlet
includes two portlet- mode i.e. view and edit. I have deployed the basic
portlet on sun portal. I have a problem with the navigation form edit
mode to view mode.

Do you have any good suggestion how to solve this problem?

Thanks in advance

Thanks and Regards,

MUKESH SINGH
CAPGEMINI Consultant
Arrive AS
T (+47) 46 47 90 16
E-post: [EMAIL PROTECTED]
http://servicedesk.arrive.no