[JBoss Seam] - captcha fails when using server state saving
by omilian3
We've implemented a captcha test which works well when saving state on the client. However, if the state is set in web.xml to be saved server side:
<context-param>
| <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
| <param-value>server</param-value>
| </context-param>
Then the captcha test fails. Running a debugger I can see that the org.jboss.seam.captcha.Captcha.validateResponse(String response) method is actually called several times. The first time, the response is correct and the method returns true, however the method is then called again with the same response without redisplaying the page. This time of course the answer has changed so the response fails and the page is redisplayed. Each subsequent time the page is submitted the number of times the validateResponse method is called increases by 1.
I'm curious to know what is going on here. Also, I notice that when running Seam we often see acessor methods and constructors called several times; is this related I wonder?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084795#4084795
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084795
18 years, 9 months
[JBoss Seam] - Re: JBoss EL performance vs Sun EL
by mgrouch
Now here is an illustration how ridiculously inefficient JSF design is.
It forces developer to write the most inefficient code
Example:
based on type value stored in columnBean.type you need to render
several different HTML controls
So you would have to repeat
<s:fragment rendered="#{columnBean.type == 'type1'">
| fragment1
| </s:fragment>
|
| and so on.
In regular programming language there would be a 'switch' statement
and since conditions are mutually exclusive after one condition is met
there is no need to evaluate others.
1) In JSF for N mutually exclusive 'rendered' conditions they will
ALWAYS be evaluated N times!!!
2) Even worse there is no syntax to assign columnBean.type to a variable
so it will be EVALUATED EACH TIME!!!
3) Even worse it will be evaluated using REFLECTION!!!
4) JSF will give you temptation to write condition as STRING comparison
(Though this is avoidable, but most people write it exactly that way cause
declaring a constant is not supported)
Please, correct me if I'm wrong about something. (Might be things are not that bad)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084793#4084793
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084793
18 years, 9 months
[JBoss Seam] - Unclear validation error messages
by kumlali
Hi,
In registration example, when I leave blank all the fields and submit the form, following error comes up:
* j_id2:j_id6: Validation Error: Value is required.
* j_id2:j_id8: Validation Error: Value is required.
* j_id2:j_id10: Validation Error: Value is required.
What I see from this is, all the messages listed together without clearly addressing the fields causing the error. "j_id2:j_id6" does not mean anything to the user, I beleive. I found that the messages came from JSF RI's Messages.properties file[1].
To surpass this, I copied messages_en.properties[2] found in seam-gen/resources under to WEB-INF/classes. This time I got following:
* value is required
* value is required
* value is required
Well, no "j_id2:j_id6" this time. But, again, there is no clear indication of what error message belongs to which field.
I am not satisfied in either case, actually. What I expect is to see label names associated with their own messages:
messages_en.properties
javax.faces.component.UIInput.REQUIRED=value is required
registration.form.username.label=Username
registration.form.real_name.label=Real Name
registration.form.password.label=Password
Output
* Username value is required
* Real Name value is required
* Password value is required
I also expect Seam to show i18 label names and messages, as well:
messages_tr.properties
javax.faces.component.UIInput.REQUIRED=alani zorunludur
registration.form.username.label=Kullanici Adi
registration.form.real_name.label=Gercek Ad
registration.form.password.label=Sifre
Output
* Kullanici Adi alani zorunludur
* Gercek Ad alani zorunludur
* Sifre alani zorunludur
But, if I wanted to show error messages immediately after the field which is the reason of error, "value is required" alone would be enough. Registration form in booking example uses this approach.
In conclusion, two questions come into my mind:
- Should I prefer error messages show up nearby the fields as in booking example?
- If I choose to show all the messages together, as in registration example, does Seam allow me to show i18 label names embedded in the error messages? If yes, how?
Regards,
Ali Sadik Kumlali
----------------------------------
[1] JSF RI - Messages.properties
javax.faces.component.UIInput.REQUIRED={0}: Validation Error: Value is required.
Here is the whole file: http://tinyurl.com/23glwk
[2] seam-gen/resources/messages_en.properties
javax.faces.component.UIInput.REQUIRED=value is required.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084792#4084792
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084792
18 years, 9 months