Have you tried:

in html:

<input jwcid="@Hidden" value="ognl:myId" id="myId" />

in java: 

public abstract class MyPage extends BasePage implements
PageBeginRenderListener {

  public abstract Long getMyId();
  public abstract void setMyId(Long id);

  public void pageBeginRender(PageEvent event) {

    MyObject myObject = getMyService().getMyObject();

    /* set the hidden value */
    setMyId(myObject.getMyId);

  }

}

Hope it helps,
Jacob


Bastian Voigt wrote:
> 
> Another question regarding tapestry programming style.
> Imagine I have a read-only property of some object which I need to include
> in 
> a hidden field in a form so that the value is still there after posting
> the 
> form. Since tapestry does not support read-only properties in forms, I
> need a 
> second read-write property which takes care of storing the value after
> post.
> 
> What I have done (inside a component class) looks like this:
> 
> // my read only property which I want to include in the form
> @Parameter()
> public abstract Object getReadOnlyValue();
> 
> // the property used for the form hidden field
> public Object getHiddenFormValue() {return getReadOnlyValue();}
> public void setHiddenFormValue(Object o) {setSomeOtherProperty(o);}
> 
> // the property where tapestry can store the hidden field value 
> // when submitting the form
> public abstract Object getSomeOtherProperty();
> public abstract void setSomeOtherProperty(Object o);
> 
> // my form submit listener
> public void listener()
> {
>       Object o = getSomeOtherProperty(); // allright, here is my value again
> }
> 
> 
> OK, it works, but IMO it is quite confusing and does not look so nice...
> Question: Are there better solutions for this problem?
> 
> -- 
> Bastian Voigt
> Neumünstersche Straße 4
> 20251 Hamburg
> telefon 040/67957171
> mobil   0179/4826359
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Using-Read-only-properties-in-forms-tf3593738.html#a10042257
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to