You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Casper Bang <ca...@gmail.com> on 2008/11/18 20:18:30 UTC

Noob question: Wicket and statefull/stateless

Pardon the (possible stupid) question, I'm new to Wicket but is quite 
excited about the simplicity it seems to promote over JSF.

What's the usual way of pushing context on to a website and have it 
passed along, such as to remain stateless? In JSF you would typically 
create some hidden inputs which can hold relevant id's or even base64 
encoded and encrypted model data. I thought perhaps Wicket were able to 
do this transparantly, as suggested by the following example:

// LetterChoice.java
final List<String> someLetters = Arrays.asList("A", "D", "C");
final DropDownChoice letter = new DropDownChoice("letter", new 
Model<String>(), someLetters);

StatelessForm form = new StatelessForm("keyForm") {
    @Override
    protected void onSubmit() {
           setResponsePage( new LetterResult( someLetters, 
Integer.parseInt( letter.getValue() ) ) );
    }
};

// LetterResult.java
public LetterResult(List<String> someLetters, int letterId) {
    String selectedLetter = someLetters.get( letterId );
}

It appears you can pass both the model as well as the selection on to a 
new page, but there's no special/hidden content in the generated 
LetterChoice webpage. Does this simply mean what I am doing i tied to my 
session or what exactly is going on?

Thanks in advance,
Casper

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