Submitting forms destroys bookmarkable URLs on re-render or validation failure.
- Dominant language
- Java
- Stars
- 127
- Forks
- 59
- Avg merge
- 23h
- Merged PRs (30d)
- 7
Description
calls ViewHandler.getActionURL() in order to resolve the attribute.
The problem here is that when a page is accessed via a bookmarkable URL, the
form action does not use that bookmarkable URL for postbacks. This means that as
soon as a form is submitted, the page query-parameters are lost, meaning that
the resource (while it may still be functionally equivalent) is no longer
capable of bookmarking.
The argument "you shouldn't bookmark after a form submit:"
Bookmarking after a form submit should be just as valid as bookmarking that
resource the first time the page was accessed via GET-based navigation.
This loss of bookmarkability occurs when a form is submitted, validation fails,
or the page is re-rendered without re-directing and including page params
through a faces-config.xml complex navigation case.
A simple use-case to show the behavior: /faces/index.xhtml
#{bar}
My proposed solution for this issue is to require that forms either:
A. re-render the URL of the page with which it was accessed.
B. require that forms call ViewHandler.getBookmarkableURL() instead of
ViewHandler.getActionURL(), and also require that any page parameter supplied
during the initial request, be preserved.
#### Environment
Operating System: Linux
Platform: PC
#### Affected Versions
[2.0]
Contributor guide
Research direction
Start with the h:form behavior and ViewHandler.getActionURL(), then compare it with ViewHandler.getBookmarkableURL(). Reproduce the example at /faces/index.xhtml, including the view parameter and command button, and verify that submitting, validation failure, or re-rendering preserves the page parameters in the resulting URL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100