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

 <form method="GET" action="">
   <input type="submit" name="Select" />

   <span wicket:id="person">
       <p>
<input wicket:id="radio" type="radio" value="http://axel.deri.ie/~axepol/foaf.rdf#me " id="webid1-radio2" name="webid"/>
           <table>
<tr><td>Name</td><td wicket:id="name">Axel Polleres</ td></tr> <tr><td>URI</td><td wicket:id="uri">http://axel.deri.ie/~axepol/foaf.rdf#me </td></tr>
           </table>
       </p>
   </span>


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 <[email protected]>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

<input wicket:id="radio" type="radio" value="radio2"
name="selectionGroup"/>
<input wicket:id="radio" type="radio" value="radio3"
name="selectionGroup"/>
...

whereas I was hoping to get

<input wicket:id="radio" type="radio" value="
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<Agent> 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:

<form wicket:id="select">
<input type="submit" name="Select"/>
<span wicket:id="selectionGroup">
<span wicket:id="person">
  <p>
  <input wicket:id="radio" type="radio" value="
http://bblfish.net/people/henry/card#me"/>
  <table>
    <tr><td>Name</td><td wicket:id="name">Henry Story</td></tr>
    <tr><td>URI</td><td wicket:id="uri">
http://bblfish.net/people/henry/card#me</td></tr>
  </table>
  </p>
</span>
</span>
<input type="submit" name="Select"/>
</form>

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: [email protected]
For additional commands, e-mail: [email protected]




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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to