javaee / javaserverfaces-spec

JavaServer(TM) Faces Specification web site
https://javaee.github.io/javaserverfaces-spec/
Other
43 stars 19 forks source link

Support view actions that execute before tree is built w/ navigation support #758

Closed glassfishrobot closed 11 years ago

glassfishrobot commented 14 years ago

JSF should provide a view metadata component that defines a method expression to be invoked before the component tree is built (or restored), with support for navigating to an alternative view afterward using navigation rules. Navigation may be the result of a constraint violation, a security restriction, or because the request was for a pseudo-view.

As an example, the developer might use a view action to load a blog entry before the view is displayed. If the entry cannot be found, the user would be redirected to another page using a navigation rule.

#{blogController.loadEntry} false /entries.xhtml This feature relates to view parameters, as the example suggests. View parameters were introduced in JSF 2.0 to provide a declarative value binding between query string parameters and model properties. They go a long way towards accommodating the action-oriented scenario in JSF. But view actions are a necessary part of the equation. is similar to , but is insuffient as a front controller. gets you by if the purpose is to perform processing at the start of the request. is intended for when you have to perform logic to verify that the view can even be rendered. View-level security is one example. Another is verifying that preconditions are met. And the key is to make navigation away from the view an integrated part when it's determined that the view cannot and should not be rendered. #### Environment Operating System: All Platform: All URL: [http://seamframework.org/Documentation/JSFEnhancementViewActions](http://seamframework.org/Documentation/JSFEnhancementViewActions) #### Affected Versions [2.0]
glassfishrobot commented 14 years ago

Reported by mojavelinux

glassfishrobot commented 14 years ago

mojavelinux said: Change target milestone.

glassfishrobot commented 14 years ago

mojavelinux said: Andy Schwartz clarifies:

1. View actions would be processed during invoke application phase. PreRenderView events are delivered during the render response phase.

2. View actions would be integrated with the navigation system (allow navigation rules to be applied). PreRenderView events require programmatic interaction with the NavigationHandler.

3. View actions would be part of the view metadata (like view parameters) and thus would be available before the full component tree has been created. PreRenderView event listeners are registered (via ) when the full component tree is created.

glassfishrobot commented 14 years ago

@edburns said: sheetalv

glassfishrobot commented 14 years ago

@edburns said: Lincoln also shared http://docs.jboss.org/seam/3/faces/reference/snapshot/en-US/html_single/#viewaction

glassfishrobot commented 14 years ago

jkva said:

glassfishrobot commented 13 years ago

rogerk said: triage

glassfishrobot commented 13 years ago

@edburns said: Bulk assign all of Sheetal's spec issues to me.

glassfishrobot commented 13 years ago

@edburns said: Move viewParameters automated test to jsf-test

glassfishrobot commented 13 years ago

@edburns said: In progress.

glassfishrobot commented 13 years ago

@edburns said: Brian, if you could please hack upon this and make it a simple sample of s:viewAction, I'd really appreciate it.

glassfishrobot commented 13 years ago

@edburns said: Brian, if you could please simply hack upon this and turn it into a simple example of s:viewAction, that would be great.

glassfishrobot commented 13 years ago

@edburns said: Sending jsf-api/build.xml Adding jsf-api/doc/expert-draft-bg.graffle Adding jsf-api/doc/expert-draft-bg.png Adding jsf-api/doc/jsdoc-template Adding jsf-api/doc/jsdoc-template/static Adding jsf-api/doc/jsdoc-template/static/default.css Sending jsf-api/doc/standard-html-renderkit-base.xml Sending jsf-api/doc/standard-html-renderkit.xml Adding jsf-api/doc/uiviewaction-props.xml Adding jsf-api/src/main/java/javax/faces/component/UIViewAction.java Sending jsf-api/src/main/java/javax/faces/context/ExternalContextWrapper.java Sending jsf-api/src/main/java/javax/faces/event/PhaseId.java Sending jsf-api/src/main/resources/jsf-api.css Sending jsf-demo/build.xml Sending jsf-ri/build.xml Sending jsf-ri/conf/share/facelets_jsf_core.taglib.xml Sending jsf-ri/conf/share/facelets_jsf_core.tld Sending jsf-ri/conf/share/tlddoc-resources/stylesheet.css Sending jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/ComponentSupport.java Sending jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/core/CoreLibrary.java Adding jsf-test/#758 Adding jsf-test/#758/build.xml Adding jsf-test/#758/i_spec_758_htmlunit Adding jsf-test/#758/i_spec_758_htmlunit/pom.xml Adding jsf-test/#758/i_spec_758_htmlunit/src Adding jsf-test/#758/i_spec_758_htmlunit/src/main Adding jsf-test/#758/i_spec_758_htmlunit/src/main/java Adding jsf-test/#758/i_spec_758_htmlunit/src/main/java/com Adding jsf-test/#758/i_spec_758_htmlunit/src/main/java/com/sun Adding jsf-test/#758/i_spec_758_htmlunit/src/main/java/com/sun/faces Adding jsf-test/#758/i_spec_758_htmlunit/src/main/java/com/sun/faces/regression Adding jsf-test/#758/i_spec_758_htmlunit/src/main/java/com/sun/faces/regression/i_spec_758 Adding jsf-test/#758/i_spec_758_htmlunit/src/main/java/com/sun/faces/regression/i_spec_758/Issue758TestCase.java Adding jsf-test/#758/i_spec_758_war Adding jsf-test/#758/i_spec_758_war/pom.xml Adding jsf-test/#758/i_spec_758_war/src Adding jsf-test/#758/i_spec_758_war/src/main Adding jsf-test/#758/i_spec_758_war/src/main/java Adding jsf-test/#758/i_spec_758_war/src/main/java/com Adding jsf-test/#758/i_spec_758_war/src/main/java/com/sun Adding jsf-test/#758/i_spec_758_war/src/main/java/com/sun/faces Adding jsf-test/#758/i_spec_758_war/src/main/java/com/sun/faces/regression Adding jsf-test/#758/i_spec_758_war/src/main/java/com/sun/faces/regression/i_spec_758 Adding jsf-test/#758/i_spec_758_war/src/main/java/com/sun/faces/regression/i_spec_758/NewsIndex.java Adding jsf-test/#758/i_spec_758_war/src/main/java/com/sun/faces/regression/i_spec_758/NewsReader.java Adding jsf-test/#758/i_spec_758_war/src/main/java/com/sun/faces/regression/i_spec_758/NewsStory.java Adding jsf-test/#758/i_spec_758_war/src/main/webapp Adding jsf-test/#758/i_spec_758_war/src/main/webapp/WEB-INF Adding jsf-test/#758/i_spec_758_war/src/main/webapp/WEB-INF/faces-config.xml Adding jsf-test/#758/i_spec_758_war/src/main/webapp/WEB-INF/web.xml Adding jsf-test/#758/i_spec_758_war/src/main/webapp/events.xhtml Adding jsf-test/#758/i_spec_758_war/src/main/webapp/page01.xhtml Adding jsf-test/#758/i_spec_758_war/src/main/webapp/page02.xhtml Adding jsf-test/#758/i_spec_758_war/src/main/webapp/page03.xhtml Adding jsf-test/#758/i_spec_758_war/src/main/webapp/template.xhtml Sending jsf-test/build.xml Sending jsf-tools/src/main/resources/com/sun/faces/generate/facesdoc/stylesheet.css Transmitting file data ................................ Committed revision 9173.

Checkpoint. Specified but not implemented.

glassfishrobot commented 13 years ago

@edburns said: snapshot. Brian Leathem's simple testcase works.

glassfishrobot commented 13 years ago

@edburns said: Snapshot, sample app based on Dan Allen's original NewsReader testcase works.

glassfishrobot commented 13 years ago

@edburns said: Snapshot to run automated tests on ADC machine.

glassfishrobot commented 13 years ago

@edburns said: The i_spec_915 testcase caught a mod in this changebundle that introduced breakage. The jsf-ri-config.xml does not need to be modified and I'm not sure why it was. Victory for automated tests.

glassfishrobot commented 13 years ago

@edburns said: Resolution attempt one realized http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-758

SECTION: Modified Files

M applicationIntegration.fm

If a matching element was located, and the element was specified in this

call getRedirectURL() on the ViewHandler, passing the current FacesContext, the , any name=value parameter pairs specified within elements within the element, and the value of the include-view-params attribute of the element if present, false, if not. The return from this method is the value to be sent to the client to which the redirect will occurr. Call getFlash().setRedirect(true) on the current FacesContext. Cause the current response to perform an HTTP redirect to this path.

Call responseComplete() on the FacesContext instance for the current request. If the content of is a value expression, first evaluate it to obtain the value of the view id.

M jsf-api/src/main/java/javax/faces/component/UIViewAction.java

M jsf-ri/conf/share/facelets_jsf_core.tld

M jsf-ri/src/main/java/com/sun/faces/application/NavigationHandlerImpl.java

M jsf-test/#758/build.xml M jsf-test/#758/i_spec_758_war/src/main/java/com/sun/faces/regression/i_spec_758/NewsReader.java M jsf-test/#758/i_spec_758_war/src/main/webapp/page02.xhtml

A jsf-test/#758/i_spec_758_simple_war A jsf-test/#758/i_spec_758_simple_war/src A jsf-test/#758/i_spec_758_simple_war/src/main A jsf-test/#758/i_spec_758_simple_war/src/main/java A jsf-test/#758/i_spec_758_simple_war/src/main/java/com A jsf-test/#758/i_spec_758_simple_war/src/main/java/com/sun A jsf-test/#758/i_spec_758_simple_war/src/main/java/com/sun/faces A jsf-test/#758/i_spec_758_simple_war/src/main/java/com/sun/faces/regression A jsf-test/#758/i_spec_758_simple_war/src/main/java/com/sun/faces/regression/i_spec_758_simple_war A jsf-test/#758/i_spec_758_simple_war/src/main/java/com/sun/faces/regression/i_spec_758_simple_war/ViewActionTestBean.java A jsf-test/#758/i_spec_758_simple_war/src/main/webapp A jsf-test/#758/i_spec_758_simple_war/src/main/webapp/main.xhtml A jsf-test/#758/i_spec_758_simple_war/src/main/webapp/WEB-INF A jsf-test/#758/i_spec_758_simple_war/src/main/webapp/WEB-INF/web.xml A jsf-test/#758/i_spec_758_simple_war/src/main/webapp/result.xhtml A jsf-test/#758/i_spec_758_simple_war/pom.xml A + jsf-test/#758/i_spec_758_htmlunit/src/main/java/com/sun/faces/regression/i_spec_758/Issue758SimpleTestCase.java

glassfishrobot commented 13 years ago

@edburns said: Sending jsf-api/src/main/java/javax/faces/component/UIViewAction.java Sending jsf-ri/conf/share/facelets_jsf_core.tld Sending jsf-ri/src/main/java/com/sun/faces/application/NavigationHandlerImpl.java Sending jsf-test/#758/build.xml Adding jsf-test/#758/i_spec_758_htmlunit/src/main/java/com/sun/faces/regression/i_spec_758/Issue758SimpleTestCase.java Adding jsf-test/#758/i_spec_758_simple_war Adding jsf-test/#758/i_spec_758_simple_war/pom.xml Adding jsf-test/#758/i_spec_758_simple_war/src Adding jsf-test/#758/i_spec_758_simple_war/src/main Adding jsf-test/#758/i_spec_758_simple_war/src/main/java Adding jsf-test/#758/i_spec_758_simple_war/src/main/java/com Adding jsf-test/#758/i_spec_758_simple_war/src/main/java/com/sun Adding jsf-test/#758/i_spec_758_simple_war/src/main/java/com/sun/faces Adding jsf-test/#758/i_spec_758_simple_war/src/main/java/com/sun/faces/regression Adding jsf-test/#758/i_spec_758_simple_war/src/main/java/com/sun/faces/regression/i_spec_758_simple_war Adding jsf-test/#758/i_spec_758_simple_war/src/main/java/com/sun/faces/regression/i_spec_758_simple_war/ViewActionTestBean.java Adding jsf-test/#758/i_spec_758_simple_war/src/main/webapp Adding jsf-test/#758/i_spec_758_simple_war/src/main/webapp/WEB-INF Adding jsf-test/#758/i_spec_758_simple_war/src/main/webapp/WEB-INF/web.xml Adding jsf-test/#758/i_spec_758_simple_war/src/main/webapp/main.xhtml Adding jsf-test/#758/i_spec_758_simple_war/src/main/webapp/result.xhtml Sending jsf-test/#758/i_spec_758_war/src/main/java/com/sun/faces/regression/i_spec_758/NewsReader.java Sending jsf-test/#758/i_spec_758_war/src/main/webapp/page02.xhtml Transmitting file data ............ Committed revision 9254.

Sending applicationIntegration.fm Sending preface.fm Transmitting file data .. Committed revision 1027.

Committed to trunk.

glassfishrobot commented 13 years ago

@edburns said: snapshot

glassfishrobot commented 13 years ago

@edburns said: Corner cases on using viewAction to go back to the same page http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-758

SECTION: Modified Files

M applicationIntegration.fm

If a matching element was located, proceed as follows.

M jsf-api/src/main/java/javax/faces/component/UIViewAction.java

M jsf-ri/src/main/java/com/sun/faces/application/NavigationHandlerImpl.java

M jsf-test/build.xml

M jsf-test/#758/i_spec_758_simple_war/src/main/java/com/sun/faces/regression/i_spec_758_simple_war/ViewActionTestBean.java A + jsf-test/#758/i_spec_758_simple_war/src/main/webapp/pageAviewActionPageA.xhtml A + jsf-test/#758/i_spec_758_simple_war/src/main/webapp/pageAviewActionEmpty.xhtml A + jsf-test/#758/i_spec_758_simple_war/src/main/webapp/pageAviewActionPageAExplicitRedirect.xhtml A jsf-test/#758/i_spec_758_simple_war/src/main/webapp/WEB-INF/faces-config.xml A + jsf-test/#758/i_spec_758_simple_war/src/main/webapp/pageAviewActionNull.xhtml M jsf-test/#758/i_spec_758_htmlunit/src/main/java/com/sun/faces/regression/i_spec_758/Issue758SimpleTestCase.java D jsf-test/#758/i_spec_758_htmlunit/src/main/java/com/sun/faces/regression/i_spec_758/Issue758TestCase.java A + jsf-test/#758/i_spec_758_htmlunit/src/main/java/com/sun/faces/regression/i_spec_758/ViewParametersTestCase.java M jsf-test/#758/build.xml

glassfishrobot commented 13 years ago

@edburns said: Committed frame changes.

Sending applicationIntegration.fm Transmitting file data . Committed revision 1028. Rhombus:frame edburns$

glassfishrobot commented 12 years ago

lamine_ba said: Hi,

Regarding the instruction below

<f:view>
<f:metadata>

<f:viewParam name="id" value="#{blogController.id}"/>
<f:viewAction execute="#{blogController.loadEntry}" onPostback="false"/>

</f:metadata>
</f:view>

I'm wondering if we could have this short variation

<f:view>
<f:metadata>

<f:viewAction param-name="id" param-value="#{blogController.id}" 
execute="#{blogController.loadEntry}" onPostback="false"/>

</f:metadata>
</f:view>

Thanks

glassfishrobot commented 12 years ago

@edburns said: Closed pending verification of implementation.

glassfishrobot commented 11 years ago

@edburns said: Leo found some additional work for this issue.

glassfishrobot commented 11 years ago

@arjantijms said: Now that the JSF 2.2 spec has been finalized, shouldn't this issue be closed as well?

glassfishrobot commented 13 years ago

File: 20110615_i_spec_758.patch Attached By: @edburns

glassfishrobot commented 13 years ago

File: 20110729-01-i_spec_758.patch Attached By: @edburns

glassfishrobot commented 13 years ago

File: 20110810-i_spec_758.patch Attached By: @edburns

glassfishrobot commented 13 years ago

File: 20110812-i_spec_758.patch Attached By: @edburns

glassfishrobot commented 13 years ago

File: 20110818-i_spec_758.patch Attached By: @edburns

glassfishrobot commented 13 years ago

File: changebundle.txt Attached By: @edburns

glassfishrobot commented 13 years ago

File: diffs.patch Attached By: @edburns

glassfishrobot commented 13 years ago

File: diffs.patch Attached By: @edburns

glassfishrobot commented 13 years ago

File: i_spec_758_war.zip Attached By: @edburns

glassfishrobot commented 13 years ago

File: newfiles.zip Attached By: @edburns

glassfishrobot commented 14 years ago

Sub-Tasks: JAVASERVERFACES_SPEC_PUBLIC-340 JAVASERVERFACES_SPEC_PUBLIC-968 JAVASERVERFACES_SPEC_PUBLIC-975

glassfishrobot commented 14 years ago

Issue-Links: depends on JAVASERVERFACES_SPEC_PUBLIC-762 JAVASERVERFACES-2165 JAVASERVERFACES-2269

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JAVASERVERFACES_SPEC_PUBLIC-758

glassfishrobot commented 11 years ago

Marked as fixed on Friday, May 10th 2013, 2:46:29 pm