Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIOutput.getValue() should return the local value of the component if it has been set, even if null. #566

Closed
eclipse-faces-bot opened this issue May 19, 2009 · 24 comments

Comments

@eclipse-faces-bot
Copy link

Consider:

for example:
<h:form>
<h:inputText id="input1" required="#

{true}

"/>
<h:message for="input1"/>
<h:inputText id="input2" value="#

{testBean.value}

">
<f:convertNumber integerOnly="true"/>
</h:inputText>
<h:message for="input2"/>
<h:commandButton/>
</h:form>

public class TestBean {
private String input1;
private Integer input2 = 1;
...
}

from browser:
1. Enter input1 empty text.
2. Enter input2 empty text.
3. submit.

results:

  • A Required error for input1 is displayed.
  • The input2 text is "1".

I hope:

  • A Required error for input1 is displayed.
  • The input2 text is empty text.

Environment

Operating System: All
Platform: Macintosh

Affected Versions

[1.2]

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
Reported by @rlubke

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
Issue-Links:
depends on
JAVASERVERFACES_SPEC_PUBLIC-67
is related to
JAVASERVERFACES-2536

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
Move to unscheduled target milestone

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
Prepare to delete api subcomponent

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
cat1

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
javadoc

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
2.0 rev a

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
These are valid 2.0 Rev a issues

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
move to P2

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
take ownership.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
may be a behavior change, moving to 2.1

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
Change target milestone.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
rogerk said:
triage

1 similar comment
@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
rogerk said:
triage

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
File: 20121020-0249-i_spec_566.patch
Attached By: @edburns

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
File: 20121023-1023-i_spec_566.patch
Attached By: @edburns

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
While the change suggested by the venerable BalusC is alluringly simple,
it causes problems right away in our existing automated tests. As a
side note, my experience tells me that such a fundamental change is
impossible to introduce at this stage in the evolution of JSF.
Nonetheless, I'll continue to entertain it in an effort to demonstrate
the impossibility of doing what the reports suggest.

Consider this testcase:

request.setAttribute("foo", "bar");
test.setValue(null);
assertNull(test.getValue());
test.setValueBinding("value", application.createValueBinding("#

{foo}

"));
assertNotNull(test.getValueBinding("value"));
assertEquals("bar", test.getValue());

In this code, "test" is an instance of UIInput. Because we have
manually called setValue(), the local value of the component has been
set. Therefore, the new code causes that value to be returned.
However, the spec for getValue() says that, in the absence of a local
value, the component's value expression must be consulted.

The root cause of all of the trouble here is that when we added
resetValue() to UIInput in JSF, way back in 2005, we should have pushed
it up to UIOutput as well. In the interest of minimizing the impact of
this change, we only put it on UIInput.

I've taken the hit now, and with that additional change, and changing
all occurrences of setValue(null) to be resetValue(), it seems the
BalusC code works.

I'm re-running the full test suite to make sure.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
Marked as fixed on Friday, October 26th 2012, 2:30:07 pm

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
michael_kurz said:
Is this really in JSF 2.2 (as indicated by the resolved status)? I just tried an example with a required input like above and Mojarra 2.2.0 still gives me the value from the value expression if I try to submit a null value for the required field.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
michael_kurz said:
OK, forget it, it is another problem I stumbled upon.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@manfredriem said:
Closing resolved issue out

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
This issue was imported from java.net JIRA JAVASERVERFACES_SPEC_PUBLIC-566

@eclipse-faces-bot
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant