Update a component

Forum sobre a ferramenta Oracle JDeveloper, ADF, OAF, etc. (Não é destinado ao aprendeziado da Linguagem Java em geral)
Post Reply
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

Hi everyone ...

I have the following problem:

I have on a page .jsp a 'Selectonechoice' and a button ... when that Button is clicked, there is a redirection for another page .. and on this page there is a form .. Where data is entered in the bank ... After the user puts the data, it should click on a button .. that gives a commit and redirects the user to previous page (that page that had the selectonchoice), on this page the selectonechoice should present some intens .. among them the one that has just been inserted ... but it does not show .. ie .. it does not update ...
But if I close the browser and open the page again it updates ...

He is not updating at run time ...

Someone knows how to tell me .. What would be the best solution for this problem? ...

Thank you from now any help ...
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

I do not know how you are doing your commit but you will have to make your vê load again ...

after your getDBTransaction().commit(); there in your am

Select all

 
voCombo.executeQuery(); 
]

If you still do not give way do this in your bean, but it is very likely that the code above already solves

Select all

 
AdfFacesContext adfContext = AdfFacesContext.getCurrentInstance(); 
adfContext.addPartialTarget(bindingSelectOneChoice); 
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

But if I do this ... he will insert on the bench twice will not go?

This is my button that inserts the data in the bank:

0]]

And this is the method he calls ...

Select all

 
    public void gerar_os_transporte ( 
                       String wplaca, 
                       int wid_user_motorista, 
                       int wid_user_conferente, 
                       String wobservacao 
                       ) 
                       {  
                    
            PreparedStatement plsqlBlock = null ; 
                String statement; 
                statement = "BEGIN pc_gerar_os_transporte(" + 
                               ":1,"+ 
                               ":2," +  
                               ":3," +  
                               ":4 ) ;" + 
                               "END;"; 
 
                plsqlBlock = getDBTransaction().createPreparedStatement(statement,0); 
                       try 
                       { 
                           plsqlBlock.setString(1,wplaca); 
                           plsqlBlock.setInt(2,wid_user_motorista); 
                           plsqlBlock.setInt(3,wid_user_conferente); 
                           plsqlBlock.setString(4,wobservacao);       
 
                          plsqlBlock.execute ();   
                       }     
                      . 
                      . 
                      .  
Note: The Commit I give inside the procedure I called ..

This second option can be done even if the button is on a page and the component to be updated in another? ...

It has to be done in the Bean Button Inserts, right?
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

Why do not you make a method in the bean that returns 'mount_transport' in the fianl and before call a method in the AM that makes your insert?!?!
and then simply call it in action

is not a good practice using actionlistener and action
as if the values ??of your ' Selectonechoice '?!?!!
Is not it by way of Vo and EO?!?!
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

ahh está .. about this td well ...

I even changed:

Select all

 
<af:commandButton 
                                  text="Gerar O.S. do Transporte" 
                                  disabled="#{!bindings[\'gerar_os_transporte\'].enabled}" 
                                  action="#{backing_OSTransporte.Gerar}"/> 

Select all

 
     public String Gerar() { 
        // Add event code here... 
         BindingContainer bindings = getBindings(); 
         OperationBinding operationBinding = bindings.getOperationBinding("gerar_os_transporte"); 
         Object result = operationBinding.execute(); 
         if (!operationBinding.getErrors().isEmpty()) { 
             return null; 
         } 
        return "montagem_transporte"; 
    } 
My Selectonechoice:

Select all

 
<af:selectOneChoice value="#{bindings.wplaca1.inputValue}" 
                                label="O.S." id="pesquisa_placa" 
                                requiredMessageDetail="Selecione uma O.S."> 
              <f:selectItems value="#{bindings.wplaca1.items}" 
                             id="valor_selecionado"/> 
            </af:selectOneChoice> 
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

My selector is based on your own form.

JSP

Select all

 
                  <af:selectOneChoice value="#{bindings.SeqsChvSecaoQst.inputValue}" 
                                      simple="true" disabled="false"> 
                    <af:forEach items="#{bindings.SecaoQstVO1.rangeSet}" 
                                var="row"> 
                      <af:selectItem value="#{row.SeqsChvSecaoQst.sequenceNumber}" 
                                     label="#{row.SeqsNomSecao}"/> 
                    </af:forEach> 
                  </af:selectOneChoice> 
Page Definition

Select all

 
<iterator id="SecaoQstVO1Iterator" RangeSize="-1" Binds="SecaoQstVO1" 
              DataControl="SegmentoClienteAMDataControl"/> 

Where 'SECOOQSTVO1' is an instance of a vo in my am

then what I said to you do is

Select all

 
getSecaoQstVO1().executeQuery(); 
Soon after your insert
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

Hi Victor ...

I'm trying to do what you gave me ...
and even the JSP code and the paidefinition all right ... but ]
Where do you shoot this method:

Select all

 
getSecaoQstVO1() 
?
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

getNomedoVO() that you put on your am
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

valeu for all help !!! : D

I already managed to solve my problem !!
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest