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!

navigating to another page in a bean

Tony007May 19 2016 — edited May 23 2016

hi am in jdeveloper 11.1.1.9  I have a situation where I have to navigate to next page based on the condition how can I do that

this is what I have done so far

hi in my AppModuleTstImpl class the have this

    protected Object callStoredFunction(int sqlReturnType, String stmt, Object[] bindVars) {

            CallableStatement cst = null;

            try {

                //Creating sql statement

                cst = this.getDBTransaction().createCallableStatement("begin ? := " + stmt + ";end;", 0);

                //Register dataType for return value

                cst.registerOutParameter(1, sqlReturnType);

                //Pass input parameters value

                if (bindVars != null) {

                    //for (int z = 0; z < bindVars.length; z++) {

                    for (int z = 0; z < bindVars.length; z++){                                              

                        cst.setObject(z + 2, bindVars[z]);

                    }

                }

                cst.executeUpdate();

                //Finally get returned value

                return cst.getObject(1);

            } catch (SQLException e) {

                throw new JboException(e.getMessage());

            } finally {

                if (cst != null) {

                    try {

                        cst.close();

                    } catch (SQLException e) {

                        e.printStackTrace();

                    }

                }

            }

        }

public String getUsrStstus(String UsrId) {

            String UserSts = "No Status found";

            Object UsrStatus = callStoredFunction(Types.VARCHAR, "Cal.Usr_status(?)", new Object[] { UsrId });

            if (UsrStatus != null) {

                UserSts = UsrStatus.toString();

            }

            return UserSts;

       public String ExecUsrPswd(String SignId,String Spswd) {

        DBTransactionImpl dbti = (DBTransactionImpl)getDBTransaction();

        CallableStatement statement =

          dbti.createCallableStatement(("BEGIN "+"cal.Pswd(?,?);" +

                                        "END;"), 0);

        try {

            statement.setString(1,SignId);

            statement.setString(2,Spswd);

            statement.registerOutParameter(2, Types.VARCHAR);

            statement.execute();

            return statement.getString(2);

        } catch (SQLException sqlerr) {

            throw new JboException(sqlerr);

        } finally {

            try {

                if (statement != null) {

                    statement.close();

                }

            } catch (SQLException closeerr) {

                throw new JboException(closeerr);

            }

        }

    }

in my bean i have this

     public void PswdValidator(FacesContext facesContext, UIComponent uIComponent,

                                  Object object) {

          //   String msg =null;

                OperationBinding oBindings = getOperationBinding("ExecUsrPswd");calling a procedure

                OperationBinding oBindingsUsr = getOperationBinding("getUsrStstus");//calling a function

                oBindings.getParamsMap().put("signid",object);

                oBindings.execute();

             

        Object o = oBindings.getResult(); //if the validation paase i what navigate to next inputtext and able to navigate to othe page

                                    //i what to call another screen if the function return status Open this screen is diffirent from the sccren if validation paased

        if(o != null) {

           String msg = o.toString();

                          FacesMessage fm = new FacesMessage(msg);

                          throw new ValidatorException(fm);

              }

                                  }

<af:inputText value="#{bindings.Password.inputValue}"

                                label="Password:"

                                columns="#{bindings.Password.hints.displayWidth}"

                                maximumLength="#{bindings.Password.hints.precision}"

                                shortDesc="#{bindings.Password.hints.tooltip}"

                                id="it1" styleClass="CriticalInputLabelStyle"

                                required="true"

                                autoSubmit="true" secret="true"

                                validator="#{pageFlowScope.SignOnValidation.PswdValidator}">

                    <f:validator/>

                  </af:inputText>

This post has been answered by Ashish Awasthi on May 20 2016
Jump to Answer

Comments

kdario

Hmm, it seems that this forum has some issues(or 'features')

Post above is reply to this thread: Image field cannot refresh when navigate records in jsf page so I don't know how this became totally new thread

Dario

BAO.SZ

Dario,

As you said, this topic is off the original thread (Image field cannot refresh when navigate records in jsf page), but is valuable to me. so I branch it as a new one.

I have two furthur question2:

1.Your suggestion to refresh page data seems a bit complicated, does it the best practice for the job?

--It seems, we also need to use Active Data technology?

2.Can have more evidence or reference docs on this sayings:

"normal way" to refresh page is usually very bad for applications based on JSF/ADF

Thanks.

BAO.SZ

I use the Actions-->branch feature.

But I cannot edit the first branched post, and you become the author of this thread.

Timo Hahn

BAZ, now things get messi

Your intention was good, however branching away the answer isn't something you, we or anybody should do. Now @"kdario" is in the drivers seat for this thread, not you. It's a flaw in the software that you can branch away part of the thread, not your fault.

Anyway I suggest that you open a new thread with your follow up question referring to the original thread. Abandon this one, please. We are happy to answer to the new thread.

Timo

BAO.SZ

Timo and kdario,

I'd glad to open a new thread for the topic. and thank you all very much for your patiences and kindness.

I think the 'Action-->.branch' is an useful feature when some improvement been made, that is:

When make the branching, the operator (which should be the author of the original thread) should be still the 'driver of the new thread',

and can edit the title and post content for the new thread.(but now cannot).

The benefit of above feature is :

1. the new thread usaually will have some relation with the original one, so keep the relation between them will make the contents/threads in this forum more relevent.

A relevant connected network of information will be more useful than a vast volume of unrelated segements of posts.

2.little inputing will be needed by branch if the author can edit the original branch out post.


Timo Hahn

I agree with you, however this is not the right place to discuss this. There is already an enhancement request (idea as it called in the new forum wording) for this at where you can add your comment and vote for the request to get implemented.

Timo

1 - 6
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 20 2016
Added on May 19 2016
18 comments
798 views