Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Display/hide attributes of the same ViewObject, in a single jspx page, in different scenarios

AkilTharMay 25 2021

I have a VO, created from an EO with a custom query.
sampleVo ::: attribute1, attribute2, attribute3, attribute4
And I need to use this VO in Front End for 2 use cases.
In one case, all the attributes (input fields) should be displayed.
In the other case, only the first 3 attributes (input fields) should be displayed.
And I want to achieve this using a single jspx page.
I have added all the attributes to the jspx page. And I'm using a hidden field getter method to hide attribute4 (Mentioned by Timo in https://community.oracle.com/tech/developers/discussion/2517074/how-to-call-a-method-call-after-view-loads))

<af:outputText id="ot5" visible="false"
                                   value="#{pageBean.lastFieldValue}"/>

    public String getLastFieldValue()
    {
        if (_logger.isLoggable(Level.INFO))
        {
            StringBuilder logMsg = new StringBuilder("Information: LAST I'm here!");

            _logger.info(logMsg.toString());
        }
        //do your work here
        return "xxx";
    }

My question is, is this the best way to do this (Having all the attributes in the page, and hiding a one when required).
And as per my knowledge, the attribute bindings are not accessible until the pageload is completed.
So I figured, we can't do any implementation at the task flows as well.
I wish to have a good understanding about this, but couldn't find any detailed documentation on this.

This post has been answered by Timo Hahn on May 25 2021
Jump to Answer
Comments
Post Details
Added on May 25 2021
2 comments
421 views