Re: setting the value of a radio input field

2009-02-11 Thread Thomas Mäder
Server side state as a performance problem is WAY overrated. If you're not
working for Google, it's probably not a problem.
That said: if your Web application has state it has state however much you
may wish it were not so. The only way to remove that state is when you move
it to the client. Then, however, you have to transfer the state to the
server in order to do anything with it, so you're trading memory vs.
bandwith. You may also transfer the state to an external system (which
Wicket does with most pages in the session). Then you're trading memory vs.
time.
If you have a MB of state per session (which is already quite a lot), you
can serve 1024 concurrent sessions per GB of server memory. These days, you
can buy 16GB of memory for just about the price of one day of work from me
(oh, perhaps I really shouldn't tell you that ;-). You'll need to measure
and then decide how important technical statelessness is for you.

"State is bad" has become an article of faith somehow. There are many
applications where that is simply not true.

Thomas

PS: Arghhh...preaching again!


On Wed, Feb 11, 2009 at 2:43 AM, Story Henry wrote:

> Thanks for the tip Thomas! I have it now.
>
> I am really keen to avoid state on the servers, as a design principle. It
> forces me to think the web way as much as possible, and when one does,
> possibilities start becoming evident. So no I did not do any measurements
> there. But these principles are also what brought be to Wicket. I like the
> separation of html and logic. I think more needs to be done perhaps to make
> stateless programming as easy, or easier than stateful programming, but I
> won't pass judgement until I have used Wicket more, and feel like I
> understand it properly.
>
> In this case I think it also makes for nice URLs.
>
> I am using Wicket 1.4rc2 btw.
>
> So here is the code that works. I even deployed it at
>
> http://test.foafssl.org/cert/
>
> The following html http://bit.ly/wFLi and the following Java:
> http://bit.ly/p735F
>
> Give the following html
>
>  
>   
>
>   
>   
>   http://axel.deri.ie/~axepol/foaf.rdf#me"
> id="webid1-radio2" name="webid"/>
>   
>   NameAxel Polleres
>   URI
> http://axel.deri.ie/~axepol/foaf.rdf#me
> 
>   
>   
>   
>
>
>
> On 10 Feb 2009, at 17:29, Thomas Mäder wrote:
>
>  The approach with
>>
>> Component radio= new Radio("radio", ...);
>>
>> is the right one. You can still try to add the AttributeModifier, but
>> probably, you'll end up fighting the Radio implementation (perhaps you'll
>> have to create a subclass?)
>> However, I don't see why you don't just use the regular wicket approach?
>> Did
>> you actually measure that there is more load on the server? I highly doubt
>> it.
>>
>> Thomas
>>
>> On Tue, Feb 10, 2009 at 4:35 PM, Story Henry > >wrote:
>>
>>  Hi,
>>>
>>> I have been looking at how to set the value of a radio input field to a
>>> value of my choosing.
>>> If I use the Radio and Radio Group code as shown here:
>>> http://pastebin.com/m40b9b073
>>> I get html such as
>>>
>>> >> name="selectionGroup"/>
>>> >> name="selectionGroup"/>
>>> ...
>>>
>>> whereas I was hoping to get
>>>
>>> http://bblfish.net/people/henry/card#me"; name="selectionGroup"/>
>>>
>>> Searching the web I found the thread "Setting a relevant value for radio
>>> buttons without using RadioChoice" from December 2008 (
>>> http://tinyurl.com/cpfj49 ) I came to understand that RadioGroup saves
>>> all
>>> the mapping itself. I would rather it did not, reducing the load on the
>>> server, as I am using URLs as primary keys. This more RESTful and I think
>>> clearner.
>>>
>>> So if I cannot set this using the Radio component I thought perhaps I can
>>> use an AttributeModifier with code like the following:
>>>
>>> class ChoiceForm extends Form {
>>>
>>>  ChoiceForm(String string, List agents) {
>>>super(string);
>>>ListView persons;
>>>add(persons=new ListView("person", agents) {
>>>
>>>   @Override
>>>   protected void populateItem(ListItem item) {
>>>  Agent agt = (Agent) item.getModelObject();
>>>  Component radio = item.get("radio"); //this is wrong! looking
>>> for solution
>>>   radio.add(new AttributeModifier("value",new
>>> Model(agt.getWebID().toString(;
>>>  item.add(new Label("name", agt.getName()));
>>>  item.add(new Label("uri", agt.getWebID().toString()));
>>>   }
>>>});
>>>persons.setReuseItems(true);
>>>  }
>>> }
>>>
>>> I am not sure how one can get a component in the populateItem function so
>>> that one can then
>>> change the attribute for it.
>>>
>>> The html I am trying to work with is this:
>>>
>>> 
>>> 
>>> 
>>> 
>>>  
>>>  http://bblfish.net/people/henry/card#me"/>
>>>  
>>>NameHenry Story
>>>URI
>>> http://bblfish.net/people/henry/card#me
>>>  
>>>  
>>> 
>>> 
>>> 
>>> 
>>>
>>> Any suggestions as t

Re: setting the value of a radio input field

2009-02-10 Thread Story Henry

Thanks for the tip Thomas! I have it now.

I am really keen to avoid state on the servers, as a design principle.  
It forces me to think the web way as much as possible, and when one  
does, possibilities start becoming evident. So no I did not do any  
measurements there. But these principles are also what brought be to  
Wicket. I like the separation of html and logic. I think more needs to  
be done perhaps to make stateless programming as easy, or easier than  
stateful programming, but I won't pass judgement until I have used  
Wicket more, and feel like I understand it properly.


In this case I think it also makes for nice URLs.

I am using Wicket 1.4rc2 btw.

So here is the code that works. I even deployed it at

http://test.foafssl.org/cert/

The following html http://bit.ly/wFLi and the following Java: 
http://bit.ly/p735F

Give the following html

 
   

   
   
   http://axel.deri.ie/~axepol/foaf.rdf#me 
" id="webid1-radio2" name="webid"/>

   
   NameAxel Pollerestd>
   URIhttp://axel.deri.ie/~axepol/foaf.rdf#me 


   
   
   


On 10 Feb 2009, at 17:29, Thomas Mäder wrote:


The approach with

Component radio= new Radio("radio", ...);

is the right one. You can still try to add the AttributeModifier, but
probably, you'll end up fighting the Radio implementation (perhaps  
you'll

have to create a subclass?)
However, I don't see why you don't just use the regular wicket  
approach? Did
you actually measure that there is more load on the server? I highly  
doubt

it.

Thomas

On Tue, Feb 10, 2009 at 4:35 PM, Story Henry  
wrote:



Hi,

I have been looking at how to set the value of a radio input field  
to a

value of my choosing.
If I use the Radio and Radio Group code as shown here:
http://pastebin.com/m40b9b073
I get html such as



...

whereas I was hoping to get

http://bblfish.net/people/henry/card#me"; name="selectionGroup"/>

Searching the web I found the thread "Setting a relevant value for  
radio

buttons without using RadioChoice" from December 2008 (
http://tinyurl.com/cpfj49 ) I came to understand that RadioGroup  
saves all
the mapping itself. I would rather it did not, reducing the load on  
the
server, as I am using URLs as primary keys. This more RESTful and I  
think

clearner.

So if I cannot set this using the Radio component I thought perhaps  
I can

use an AttributeModifier with code like the following:

class ChoiceForm extends Form {

 ChoiceForm(String string, List agents) {
super(string);
ListView persons;
add(persons=new ListView("person", agents) {

   @Override
   protected void populateItem(ListItem item) {
  Agent agt = (Agent) item.getModelObject();
  Component radio = item.get("radio"); //this is wrong!  
looking

for solution
   radio.add(new AttributeModifier("value",new
Model(agt.getWebID().toString(;
  item.add(new Label("name", agt.getName()));
  item.add(new Label("uri", agt.getWebID().toString()));
   }
});
persons.setReuseItems(true);
 }
}

I am not sure how one can get a component in the populateItem  
function so

that one can then
change the attribute for it.

The html I am trying to work with is this:





  
  http://bblfish.net/people/henry/card#me"/>
  
NameHenry Story
URI
http://bblfish.net/people/henry/card#me
  
  





Any suggestions as to where I should look for more information. I  
have
searched all over the internet and Wicket In Action, but without  
success.


  Henry Story

Blog: http://blogs.sun.com/bblfish


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





--
Thomas Mäder
Wicket & Eclipse Consulting
www.devotek-it.ch



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



Re: setting the value of a radio input field

2009-02-10 Thread Thomas Mäder
The approach with

Component radio= new Radio("radio", ...);

is the right one. You can still try to add the AttributeModifier, but
probably, you'll end up fighting the Radio implementation (perhaps you'll
have to create a subclass?)
However, I don't see why you don't just use the regular wicket approach? Did
you actually measure that there is more load on the server? I highly doubt
it.

Thomas

On Tue, Feb 10, 2009 at 4:35 PM, Story Henry wrote:

> Hi,
>
> I have been looking at how to set the value of a radio input field to a
> value of my choosing.
> If I use the Radio and Radio Group code as shown here:
> http://pastebin.com/m40b9b073
> I get html such as
>
>  name="selectionGroup"/>
>  name="selectionGroup"/>
> ...
>
> whereas I was hoping to get
>
> http://bblfish.net/people/henry/card#me"; name="selectionGroup"/>
>
> Searching the web I found the thread "Setting a relevant value for radio
> buttons without using RadioChoice" from December 2008 (
> http://tinyurl.com/cpfj49 ) I came to understand that RadioGroup saves all
> the mapping itself. I would rather it did not, reducing the load on the
> server, as I am using URLs as primary keys. This more RESTful and I think
> clearner.
>
> So if I cannot set this using the Radio component I thought perhaps I can
> use an AttributeModifier with code like the following:
>
> class ChoiceForm extends Form {
>
>   ChoiceForm(String string, List agents) {
>  super(string);
>  ListView persons;
>  add(persons=new ListView("person", agents) {
>
> @Override
> protected void populateItem(ListItem item) {
>Agent agt = (Agent) item.getModelObject();
>Component radio = item.get("radio"); //this is wrong! looking
> for solution
> radio.add(new AttributeModifier("value",new
> Model(agt.getWebID().toString(;
>item.add(new Label("name", agt.getName()));
>item.add(new Label("uri", agt.getWebID().toString()));
> }
>  });
>  persons.setReuseItems(true);
>   }
> }
>
> I am not sure how one can get a component in the populateItem function so
> that one can then
> change the attribute for it.
>
> The html I am trying to work with is this:
>
> 
>  
>  
>  
>
>http://bblfish.net/people/henry/card#me"/>
>
>  NameHenry Story
>  URI
> http://bblfish.net/people/henry/card#me
>
>
>  
>  
>  
>  
>
> Any suggestions as to where I should look for more information. I have
> searched all over the internet and Wicket In Action, but without success.
>
>Henry Story
>
> Blog: http://blogs.sun.com/bblfish
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Thomas Mäder
Wicket & Eclipse Consulting
www.devotek-it.ch


setting the value of a radio input field

2009-02-10 Thread Story Henry

Hi,

I have been looking at how to set the value of a radio input field to  
a value of my choosing.

If I use the Radio and Radio Group code as shown here: 
http://pastebin.com/m40b9b073
I get html such as

name="selectionGroup"/>
name="selectionGroup"/>

...

whereas I was hoping to get

http://bblfish.net/people/henry/card#me 
" name="selectionGroup"/>


Searching the web I found the thread "Setting a relevant value for  
radio buttons without using RadioChoice" from December 2008 (  http://tinyurl.com/cpfj49 
 ) I came to understand that RadioGroup saves all the mapping itself.  
I would rather it did not, reducing the load on the server, as I am  
using URLs as primary keys. This more RESTful and I think clearner.


So if I cannot set this using the Radio component I thought perhaps I  
can use an AttributeModifier with code like the following:


class ChoiceForm extends Form {

   ChoiceForm(String string, List agents) {
  super(string);
  ListView persons;
  add(persons=new ListView("person", agents) {

 @Override
 protected void populateItem(ListItem item) {
Agent agt = (Agent) item.getModelObject();
Component radio = item.get("radio"); //this is wrong!  
looking for solution
 radio.add(new AttributeModifier("value",new  
Model(agt.getWebID().toString(;

item.add(new Label("name", agt.getName()));
item.add(new Label("uri", agt.getWebID().toString()));
 }
  });
  persons.setReuseItems(true);
   }
}

I am not sure how one can get a component in the populateItem function  
so that one can then

change the attribute for it.

The html I am trying to work with is this:


  
  
  

http://bblfish.net/people/henry/card#me 
"/>


  NameHenry Story
  URIhttp://bblfish.net/people/henry/card#me 




  
  
  
 

Any suggestions as to where I should look for more information. I have  
searched all over the internet and Wicket In Action, but without  
success.


Henry Story

Blog: http://blogs.sun.com/bblfish


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