Default value for viewParam
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 127
- Forks
- 59
- Avg merge
- 23h
- Merged PRs (30d)
- 7
Description
What about allowing the definition of a default value for a view-parameter?
**Example**
Defining number of displayed items (pagination feature) as a view-parameter but still keeping default value within xhtml and not java bean.
Following example is a very clean approach provinding a default value.
```
```
Currently there are two workarounds which have no clean separation between markup and java code:
**Workaround 1**
Passing the default value to bean.
```
```
```
private int pageSize;
public void initPreRenderView(int pageSize)
{
if (this.pageSize == 0)
this.pageSize == pageSize;
}
```
**Workaround 2**
Hardcoding the default value in bean. But markup should be responsible and not bean.
```
```
```
private int pageSize = 10;
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the XHTML f:viewParam value is processed when the request omits pageSize. The change is complete when a declared default such as 10 is used without Java-bean initialization, while an explicitly supplied parameter still takes precedence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100