You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Donyee <xy...@gmail.com> on 2007/07/19 10:30:54 UTC

[T5]How to submit a hidden value?

I need to submit a hidden value, so i write like this:(copy from this TextField)

public class HiddenField extends AbstractTextField {
	@Override
	protected final void writeFieldTag(MarkupWriter writer, String value) {
		writer.element("input", "type", "hidden", "name", getElementName(), "id",
				getClientId(), "value", value);
	}

	final void afterRender(MarkupWriter writer) {
		writer.end(); // input
	}

}
but it doesn't works!
Can anyone help??


----徐 依伟

Re: [T5]How to submit a hidden value?

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Yeah, well done. Writing components in Tapestry is so easy and fun. :-)

You can probably delete the _request and have an empty processSubmission() too.

Cheers,
Nick.


Donyee wrote:
> The new code works fine!
> 
> public class HiddenField extends AbstractField {
>     @Parameter(required = true, principal = true)
>     private String _value;
> 
>     @Inject
>     private Request _request;
> 
>     final void afterRender(MarkupWriter writer) {
>         writer.end(); // input
>     }
> 
>     @Override
>     protected void processSubmission(FormSupport formSupport, String 
> elementName) {
>         // TODO Auto-generated method stub
> 
>         _value = _request.getParameter(elementName);
>     }
> 
>     void beginRender(MarkupWriter writer) {
>         writer.element("input", "type", "hidden", "name", getElementName(),
>                 "id", getClientId(), "value","");
>     }
> 
>     
> }
> 
> 2007/7/19, Nick Westgate <ni...@key-planning.co.jp>:
>> Sure. It should be pretty simple. First, please define "doesn't work".
>> Does anything get written into the html?
>>
>> Also, you probably want to extend AbstractField, not AbstractTextField.
>>
>> Cheers,
>> Nick.
>>
>>
>> Donyee wrote:
>> > I need to submit a hidden value, so i write like this:(copy from this
>> > TextField)
>> >
>> > public class HiddenField extends AbstractTextField {
>> >     @Override
>> >     protected final void writeFieldTag(MarkupWriter writer, String 
>> value) {
>> >         writer.element("input", "type", "hidden", "name",
>> > getElementName(), "id",
>> >                 getClientId(), "value", value);
>> >     }
>> >
>> >     final void afterRender(MarkupWriter writer) {
>> >         writer.end(); // input
>> >     }
>> >
>> > }
>> > but it doesn't works!
>> > Can anyone help??
>> >
>> >
>> > ----徐 依伟
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 

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


Re: T3: OutOfMemory on ExprssionBinding and StaticBinding

Posted by Jesse Kuhnert <jk...@gmail.com>.
4.1.2 has a robust page pool "built in" that expires pages automatically.

On 7/19/07, Nick Westgate <ni...@key-planning.co.jp> wrote:
>
> Hi Rudie.
>
> A few extra notes ...
>
> One problem was permgen being filled by Tapestry's class
> creation/instrumentation, and the other is that the default
> Pool only adds pages - it never removes or limits them.
>
> If you check old Tapestry 3 era posts about "out of memory"
> you'll also see some recommendations for JVM settings:
>
> -XX:MaxNewSize=300m -XX:MaxPermSize=300m
>
> Also for Tapestry 4(.0?) Henri Dupre created a "SoftPool"
> that used SoftReferences which solved his memory problems.
>
> You could also enable the cache/pool reset service.
> HTH.
>
> Cheers,
> Nick.
>
>
> Rudie Ekkelenkamp wrote:
> > Hi Nick,
> >
> > Thanks for the suggestion.
> > We're already using a custom Engine class, so it shouldn't be too hard
> > to create a custom Pool.
> >
> > Cheers,
> >
> > Rudie.
> >
> > -----Oorspronkelijk bericht-----
> > Van: Nick Westgate [mailto:nick@key-planning.co.jp]
> > Verzonden: donderdag 19 juli 2007 14:28
> > Aan: Tapestry users
> > Onderwerp: Re: T3: OutOfMemory on ExprssionBinding and StaticBinding
> >
> >> Is there a way in Tapestry 3 to limit the maximum number of page
> >> entries?
> >
> > I don't think it's built in, no.
> >
> >> In Tapestry 4 there is the org.apache.tapestry.page-pool-max-active
> >> setting, but it doesn't seem to be available for Tapestry 3.
> >> Maybe any other suggestions on how to avoid this large number of
> >> Bindings?
> >
> > Not sure, but have a look in AbstractEngine:
> >
> >       *  Returns an new instance of {@link Pool}, with the standard
> >       *  set of adaptors, plus {@link BSFManagerPoolableAdaptor} for
> >       *  {@link BSFManager}.
> >       *
> >       *  <p>Subclasses may override this
> >       *  method to configure the Pool differently.
> >       *
> >       *  @since 3.0
> >       *
> >       **/
> >
> >      protected Pool createPool(RequestContext context)
> >
> >
> > Cheers,
> > Nick.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> >
> > DISCLAIMER:
> >
> > Dit bericht (met bijlagen) is met grote zorgvuldigheid samengesteld.
> Voor mogelijke onjuistheid en/of onvolledigheid van de hierin verstrekte
> informatie kan Stichting Kennisnet Ict op school geen aansprakelijkheid
> aanvaarden, evenmin kunnen aan de inhoud van dit bericht (met bijlagen)
> rechten worden ontleend. De inhoud van dit bericht (met bijlagen) kan
> vertrouwelijke informatie bevatten en is uitsluitend bestemd voor de
> geadresseerde van dit bericht. Indien u niet de beoogde ontvanger van dit
> bericht bent, verzoekt Stichting Kennisnet Ict op school u dit bericht te
> verwijderen, eventuele bijlagen niet te openen en wijst Stichting Kennisnet
> Ict op school u op de onrechtmatigheid van het gebruiken, kopiëren of
> verspreiden van de inhoud van dit bericht (met bijlagen).
> >
> > This message (with attachments) is given in good faith. Stichting
> Kennisnet Ict op school cannot assume any responsibility for the accuracy or
> reliability of the information contained in this message (with attachments),
> nor shall the information be construed as constituting any obligation on the
> part of Stichting Kennisnet Ict op school. The information contained in this
> message (with attachments) may be confidential or privileged and is only
> intended for the use of the named addressee. If you are not the intended
> recipient, you are requested by Stichting Kennisnet Ict op school to delete
> this message (with attachments) without opening it and you are notified by
> Stichting Kennisnet Ict op school that any disclosure, copying or
> distribution of the information contained in this message (with attachments)
> is strictly prohibited and unlawful.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

Re: T3: OutOfMemory on ExprssionBinding and StaticBinding

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Hi Rudie.

A few extra notes ...

One problem was permgen being filled by Tapestry's class
creation/instrumentation, and the other is that the default
Pool only adds pages - it never removes or limits them.

If you check old Tapestry 3 era posts about "out of memory"
you'll also see some recommendations for JVM settings:

-XX:MaxNewSize=300m -XX:MaxPermSize=300m

Also for Tapestry 4(.0?) Henri Dupre created a "SoftPool"
that used SoftReferences which solved his memory problems.

You could also enable the cache/pool reset service.
HTH.

Cheers,
Nick.


Rudie Ekkelenkamp wrote:
> Hi Nick,
> 
> Thanks for the suggestion. 
> We're already using a custom Engine class, so it shouldn't be too hard
> to create a custom Pool.
> 
> Cheers,
> 
> Rudie. 
> 
> -----Oorspronkelijk bericht-----
> Van: Nick Westgate [mailto:nick@key-planning.co.jp] 
> Verzonden: donderdag 19 juli 2007 14:28
> Aan: Tapestry users
> Onderwerp: Re: T3: OutOfMemory on ExprssionBinding and StaticBinding
> 
>> Is there a way in Tapestry 3 to limit the maximum number of page 
>> entries?
> 
> I don't think it's built in, no.
> 
>> In Tapestry 4 there is the org.apache.tapestry.page-pool-max-active
>> setting, but it doesn't seem to be available for Tapestry 3.
>> Maybe any other suggestions on how to avoid this large number of 
>> Bindings?
> 
> Not sure, but have a look in AbstractEngine:
> 
>       *  Returns an new instance of {@link Pool}, with the standard
>       *  set of adaptors, plus {@link BSFManagerPoolableAdaptor} for
>       *  {@link BSFManager}.
>       *
>       *  <p>Subclasses may override this
>       *  method to configure the Pool differently.
>       *
>       *  @since 3.0
>       *
>       **/
> 
>      protected Pool createPool(RequestContext context)
> 
> 
> Cheers,
> Nick.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 
> DISCLAIMER:
> 
> Dit bericht (met bijlagen) is met grote zorgvuldigheid samengesteld. Voor mogelijke onjuistheid en/of onvolledigheid van de hierin verstrekte informatie kan Stichting Kennisnet Ict op school geen aansprakelijkheid aanvaarden, evenmin kunnen aan de inhoud van dit bericht (met bijlagen) rechten worden ontleend. De inhoud van dit bericht (met bijlagen) kan vertrouwelijke informatie bevatten en is uitsluitend bestemd voor de geadresseerde van dit bericht. Indien u niet de beoogde ontvanger van dit bericht bent, verzoekt Stichting Kennisnet Ict op school u dit bericht te verwijderen, eventuele bijlagen niet te openen en wijst Stichting Kennisnet Ict op school u op de onrechtmatigheid van het gebruiken, kopiëren of verspreiden van de inhoud van dit bericht (met bijlagen).
> 
> This message (with attachments) is given in good faith. Stichting Kennisnet Ict op school cannot assume any responsibility for the accuracy or reliability of the information contained in this message (with attachments), nor shall the information be construed as constituting any obligation on the part of Stichting Kennisnet Ict op school. The information contained in this message (with attachments) may be confidential or privileged and is only intended for the use of the named addressee. If you are not the intended recipient, you are requested by Stichting Kennisnet Ict op school to delete this message (with attachments) without opening it and you are notified by Stichting Kennisnet Ict op school that any disclosure, copying or distribution of the information contained in this message (with attachments) is strictly prohibited and unlawful.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 

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


RE: T3: OutOfMemory on ExprssionBinding and StaticBinding

Posted by Rudie Ekkelenkamp <R....@kenict.org>.
Hi Nick,

Thanks for the suggestion. 
We're already using a custom Engine class, so it shouldn't be too hard
to create a custom Pool.

Cheers,

Rudie. 

-----Oorspronkelijk bericht-----
Van: Nick Westgate [mailto:nick@key-planning.co.jp] 
Verzonden: donderdag 19 juli 2007 14:28
Aan: Tapestry users
Onderwerp: Re: T3: OutOfMemory on ExprssionBinding and StaticBinding

> Is there a way in Tapestry 3 to limit the maximum number of page 
> entries?

I don't think it's built in, no.

> In Tapestry 4 there is the org.apache.tapestry.page-pool-max-active
> setting, but it doesn't seem to be available for Tapestry 3.
> Maybe any other suggestions on how to avoid this large number of 
> Bindings?

Not sure, but have a look in AbstractEngine:

      *  Returns an new instance of {@link Pool}, with the standard
      *  set of adaptors, plus {@link BSFManagerPoolableAdaptor} for
      *  {@link BSFManager}.
      *
      *  <p>Subclasses may override this
      *  method to configure the Pool differently.
      *
      *  @since 3.0
      *
      **/

     protected Pool createPool(RequestContext context)


Cheers,
Nick.

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



DISCLAIMER:

Dit bericht (met bijlagen) is met grote zorgvuldigheid samengesteld. Voor mogelijke onjuistheid en/of onvolledigheid van de hierin verstrekte informatie kan Stichting Kennisnet Ict op school geen aansprakelijkheid aanvaarden, evenmin kunnen aan de inhoud van dit bericht (met bijlagen) rechten worden ontleend. De inhoud van dit bericht (met bijlagen) kan vertrouwelijke informatie bevatten en is uitsluitend bestemd voor de geadresseerde van dit bericht. Indien u niet de beoogde ontvanger van dit bericht bent, verzoekt Stichting Kennisnet Ict op school u dit bericht te verwijderen, eventuele bijlagen niet te openen en wijst Stichting Kennisnet Ict op school u op de onrechtmatigheid van het gebruiken, kopi�ren of verspreiden van de inhoud van dit bericht (met bijlagen).

This message (with attachments) is given in good faith. Stichting Kennisnet Ict op school cannot assume any responsibility for the accuracy or reliability of the information contained in this message (with attachments), nor shall the information be construed as constituting any obligation on the part of Stichting Kennisnet Ict op school. The information contained in this message (with attachments) may be confidential or privileged and is only intended for the use of the named addressee. If you are not the intended recipient, you are requested by Stichting Kennisnet Ict op school to delete this message (with attachments) without opening it and you are notified by Stichting Kennisnet Ict op school that any disclosure, copying or distribution of the information contained in this message (with attachments) is strictly prohibited and unlawful.


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


Re: T3: OutOfMemory on ExprssionBinding and StaticBinding

Posted by Nick Westgate <ni...@key-planning.co.jp>.
> Is there a way in Tapestry 3 to limit the maximum number of page
> entries? 

I don't think it's built in, no.

> In Tapestry 4 there is the org.apache.tapestry.page-pool-max-active
> setting, but it doesn't seem to be available for Tapestry 3.
> Maybe any other suggestions on how to avoid this large number of
> Bindings?

Not sure, but have a look in AbstractEngine:

      *  Returns an new instance of {@link Pool}, with the standard
      *  set of adaptors, plus {@link BSFManagerPoolableAdaptor} for
      *  {@link BSFManager}.
      *
      *  <p>Subclasses may override this
      *  method to configure the Pool differently.
      *
      *  @since 3.0
      *
      **/

     protected Pool createPool(RequestContext context)


Cheers,
Nick.

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


T3: OutOfMemory on ExprssionBinding and StaticBinding

Posted by Rudie Ekkelenkamp <R....@kenict.org>.
Hi,

We're running a webapplication using tapestry 3.0.3, spring and
hibernate and it performs quite well.
Unfortunately during peak hours we run into OutOfMemory errors. 
Using jhat we analyzed the memory dump and noticed a lot of
ExpressionBinding and StaticBinding instances.
I assume this occurs because during a peak the number of concurrent
requests is high and this will increase the Tapestry Page Pool size.
Is there a way in Tapestry 3 to limit the maximum number of page
entries? 
In Tapestry 4 there is the org.apache.tapestry.page-pool-max-active
setting, but it doesn't seem to be available for Tapestry 3.
Maybe any other suggestions on how to avoid this large number of
Bindings?

This is the instance count for all non system classes:

259257 instances of class org.hibernate.util.IdentityMap$IdentityKey 
256512 instances of class
org.apache.commons.collections.SequencedHashMap$Entry 
255095 instances of class org.hibernate.engine.EntityKey 
254337 instances of class org.hibernate.engine.EntityEntry 
249755 instances of class
org.hibernate.util.IdentityMap$IdentityMapEntry 
17759 instances of class org.apache.tapestry.binding.ExpressionBinding 
12002 instances of class org.apache.tapestry.binding.StaticBinding

Thanx in advance,

Rudie Ekkelenkamp.


DISCLAIMER:

Dit bericht (met bijlagen) is met grote zorgvuldigheid samengesteld. Voor mogelijke onjuistheid en/of onvolledigheid van de hierin verstrekte informatie kan Stichting Kennisnet Ict op school geen aansprakelijkheid aanvaarden, evenmin kunnen aan de inhoud van dit bericht (met bijlagen) rechten worden ontleend. De inhoud van dit bericht (met bijlagen) kan vertrouwelijke informatie bevatten en is uitsluitend bestemd voor de geadresseerde van dit bericht. Indien u niet de beoogde ontvanger van dit bericht bent, verzoekt Stichting Kennisnet Ict op school u dit bericht te verwijderen, eventuele bijlagen niet te openen en wijst Stichting Kennisnet Ict op school u op de onrechtmatigheid van het gebruiken, kopi�ren of verspreiden van de inhoud van dit bericht (met bijlagen).

This message (with attachments) is given in good faith. Stichting Kennisnet Ict op school cannot assume any responsibility for the accuracy or reliability of the information contained in this message (with attachments), nor shall the information be construed as constituting any obligation on the part of Stichting Kennisnet Ict op school. The information contained in this message (with attachments) may be confidential or privileged and is only intended for the use of the named addressee. If you are not the intended recipient, you are requested by Stichting Kennisnet Ict op school to delete this message (with attachments) without opening it and you are notified by Stichting Kennisnet Ict op school that any disclosure, copying or distribution of the information contained in this message (with attachments) is strictly prohibited and unlawful.


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


Re: [T5]How to submit a hidden value?

Posted by Donyee <xy...@gmail.com>.
The new code works fine!

public class HiddenField extends AbstractField {
	@Parameter(required = true, principal = true)
	private String _value;

	@Inject
	private Request _request;

	final void afterRender(MarkupWriter writer) {
		writer.end(); // input
	}

	@Override
	protected void processSubmission(FormSupport formSupport, String elementName) {
		// TODO Auto-generated method stub

		_value = _request.getParameter(elementName);
	}

	void beginRender(MarkupWriter writer) {
		writer.element("input", "type", "hidden", "name", getElementName(),
				"id", getClientId(), "value","");
	}

	
}

2007/7/19, Nick Westgate <ni...@key-planning.co.jp>:
> Sure. It should be pretty simple. First, please define "doesn't work".
> Does anything get written into the html?
>
> Also, you probably want to extend AbstractField, not AbstractTextField.
>
> Cheers,
> Nick.
>
>
> Donyee wrote:
> > I need to submit a hidden value, so i write like this:(copy from this
> > TextField)
> >
> > public class HiddenField extends AbstractTextField {
> >     @Override
> >     protected final void writeFieldTag(MarkupWriter writer, String value) {
> >         writer.element("input", "type", "hidden", "name",
> > getElementName(), "id",
> >                 getClientId(), "value", value);
> >     }
> >
> >     final void afterRender(MarkupWriter writer) {
> >         writer.end(); // input
> >     }
> >
> > }
> > but it doesn't works!
> > Can anyone help??
> >
> >
> > ----徐 依伟
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
----徐 依伟

Re: [T5]How to submit a hidden value?

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Sure. It should be pretty simple. First, please define "doesn't work".
Does anything get written into the html?

Also, you probably want to extend AbstractField, not AbstractTextField.

Cheers,
Nick.


Donyee wrote:
> I need to submit a hidden value, so i write like this:(copy from this 
> TextField)
> 
> public class HiddenField extends AbstractTextField {
>     @Override
>     protected final void writeFieldTag(MarkupWriter writer, String value) {
>         writer.element("input", "type", "hidden", "name", 
> getElementName(), "id",
>                 getClientId(), "value", value);
>     }
> 
>     final void afterRender(MarkupWriter writer) {
>         writer.end(); // input
>     }
> 
> }
> but it doesn't works!
> Can anyone help??
> 
> 
> ----徐 依伟

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