Form component's validate parameter cause excpetions when clients use zh-cn language

2012-03-28 Thread Fight Ice
When the client web browser use the zh_cn locale to load my login page, i get a exception like this : Render queue error in BeginRender[admin/Login:username]: d != java.lang.String but if client use the en locale, it works correctly. if i want to use zh_cn locale to load my login page, i found t

RE: Form component's validate parameter cause excpetions when clients use zh-cn language

2012-03-28 Thread Fight Ice
Thanks! just add two lines to the app.properties: minimum-string-length=\u60a8\u5fc5\u987b\u4e3a %2$s \u63d0\u4f9b\u81f3\u5c11 %1$d \u5b57\u7b26\u3002 maximum-string-length=\u60a8\u6700\u591a\u80fd\u4e3a %2$s \u63d0\u4f9b\u81f3\u5c11 %1$d \u5b57\u7b26\u3002 All works correctly!

How to prevent form being submit in mixins when validation failed

2012-05-12 Thread Fight Ice
I have a mixins to validate the username field and email field using ajax. but in my ValidateField.js file, i use: Event.observe(this.sourceField.form,'submit',this.doSubmit.bindAsEventListener(this)); doSubmit:function(event){ return this.state; } but the form still submit even the "d

Tapestry Regexp Validator

2012-05-18 Thread Fight Ice
Tapestry 5.3.2: I try to use Email validator in my email input field, but it doesn't work. Then I use the regexp validator in my properties file like this: email-regexp=^[a-zA-Z0-9_\-]+@[a-zA-Z0-9_\-]+(\.[a-zA-Z0-9_\-]+)+$ It still doesn't work. Finally I found even regexp like this "^[1-9]" does

RE: Tapestry Regexp Validator

2012-05-18 Thread Fight Ice
in template file: in properties file: productAmount-regexp=^[1-9] The product amount can't start with zero. > From: ricr...@hotmail.com > To: users@tapestry.apache.org > Subject: Tapestry Regexp Validator > Date: Fri, 18 May 2012 15:58:12 +0800 > > > Tapestry 5.3.

RE: Tapestry Regexp Validator

2012-05-18 Thread Fight Ice
productAmount-regexp=^[1-9][0-9]* > Subject: Re: Tapestry Regexp Validator > From: tawus.tapes...@gmail.com > Date: Fri, 18 May 2012 13:43:28 +0530 > To: users@tapestry.apache.org > > > Can you share the code ? > > > On May 18, 2012, at 1:28 PM, Fight Ice wro

RE: Tapestry Regexp Validator

2012-05-18 Thread Fight Ice
> that so ? > > if it is a number not starting with zero shouldn't it be ^[1-9][0-9]* or > ^[1-9]\\d* > > On May 18, 2012, at 1:55 PM, Fight Ice wrote: > > > > > in template file: > > > > > t:validate="

RE: Tapestry Regexp Validator

2012-05-18 Thread Fight Ice
Solved! In my java file: @Property private int productAmount; The "productAmount" is int type. So the regexp validator doesn't works. Thanks a lot Taha! This case confused me. Why and how this happened?

RE: Tapestry Regexp Validator

2012-05-18 Thread Fight Ice
So I can't use int type for the field which uses the regexp. Could anyone give me some advices for this case?

Hibernate Transaction

2012-05-27 Thread Fight Ice
java code: Transaction ts=session.beginTransaction(); Criteria criteria=session.createCriteria(Item.class); criteria.add(Restrictions.idEq(product.getItem().getId())); criteria.setLockMode(LockMode.PESSIMISTIC_WRITE); Item item=(Item)criteria.list().get(0); ... ts.commit(); ... Transaction tc=ses

RE: Hibernate Transaction

2012-05-27 Thread Fight Ice
Thx, I use HibernateSessionSource.create(). Is this thread safe?

About per-thread service

2012-05-30 Thread Fight Ice
I have read the source code of HibernateCoreModule.java and HibernateSessionManagerImpl.java . The HibernateSessionManager service is per-thread, but I didn't find any code for concurrency(like using ThreadLocal). How Tapestry make HibernateSessionManager service to be per-thread.

RE: About per-thread service

2012-05-30 Thread Fight Ice
The @Scope(ScopeConstants.PERTHREAD) makes the service per-thread, and finally the SessionFactory.openSession() will be called(SessionFactory is thread safe). One session for one thread(request)?

onActivate event and ajax request

2012-06-09 Thread Fight Ice
java code String onActivate(EventContext eventContext){ if(eventContext.getCount==0){ return "index"; } if(eventContext.getCount==1){ //do something } // ... } Object onSubmitComment(@RequestParameter(COMMENT_PARAM) String comment){ //do something } I used firebug and found that client receive "

RE: onActivate event and ajax request

2012-06-09 Thread Fight Ice
@Inject private Request request; if(eventContext.getCount()==0){ if(request.isXHR()){ return null; } return "index"; } Any better idea?