Click on J button to display record set

How to write a code to click o j button to display record set of MS Access database

http://java.sun.com/docs/books/tutorial/jdbc/index.html
Create a class to perform DB related stuff and call in when the button is clicked. Your question is too generic. It would be better if ou asked a specific query.

Similar Messages

  • Catch the Excep while clicking on a button and display the msg in JSF UI

    Hi,
    I am facing a issue like i have a add button in my JSF page which will add Partner code, Partner name,etc..,
    If i give the same partner code and partner name second time it is throwing the duplicate key exception
    org.apache.myfaces.component.html.ext.HtmlSelectOneMenu@319e5b
    Calling Save Method.............
    Record Saved..............
    (util.JDBCExceptionReporter 71 ) SQL Error: 1062, SQLState: 23000
    (util.JDBCExceptionReporter 72 ) Duplicate entry 'T1-test1' for key 1
    (def.AbstractFlushingEventListener 299 ) Could not synchronize database state with session
    org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
         at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
         at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
         at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:230)
         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
         at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
         at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
         at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1007)
         at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:354)
         at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
         at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:584)
         at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:496)
         at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:469)
         at org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:266)
         at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
         at $Proxy31.save(Unknown Source)
         at com.finnair.pba.handler.PartnerMastCtrl.addAction(PartnerMastCtrl.java:110)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
         at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
         at com.sun.rave.web.ui.appbase.faces.ActionListenerImpl.processAction(ActionListenerImpl.java:57)
         at javax.faces.component.UICommand.broadcast(UICommand.java:106)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
         at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.sql.BatchUpdateException: Duplicate entry 'T1-test1' for key 1
         at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647)
         at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
         at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
         ... 51 more
    I am using JSF,Spring and Hibernate.
    I would like to catch this exception and throw it in the JSF UI near partner code field as a message.
    Is this possible to do.
    My JSF:
    <tr>
    <td width="30%" align="right" ><b><h:outputText id="pPartnerCode" value="Partner Code" /></b><span style="color:red">*</span></td>
    <td width="60%">:
    <h:inputText id="partnerCode" value="#{partnerMast.partnerCode}" required="true">     
    <t:validateRegExpr pattern="^[a-z||A-Z||0-9||_||\s||/]+$" />
    <f:validateLength minimum="1" maximum="3" />     
    </h:inputText>          
    <h:message for="partnerCode" showDetail="true" style="color:red" /></td>
    </tr>
    <tr>
    <td width="40%" align="right"><b><h:outputText id="pPartnerName" value="Partner Name" /><span style="color:red">*</span></b></td>
    <td width="60%" align="left">:               
    <h:inputText id="partnerName" value="#{partnerMast.partnerName}" required="true" >     
    <t:validateRegExpr pattern="^[a-z||A-Z||0-9||_||\s||/]+$" />
    <f:validateLength minimum="1" maximum="50"/>     
    </h:inputText>
    <h:message for="partnerName" showDetail="true" style="color:red" />
    </td>
    </tr>
    <h:commandButton id="addUser" value="Save" action="#{partnerMastCtrl.addAction}" styleClass="style10"/>
    My controller:
    public String addAction()
    try
    partnerMast = (PartnerMast)context.getExternalContext().getSessionMap().get("partnerMast");
    partnerHostingMast = (PartnerHostingMast) context.getExternalContext().getSessionMap().get("partnerHostingMast");
    this.getService();
    if(partnerHostingMast != null && partnerHostingMast.getHostingPartner() != null && partnerMast.getPartnerType().equalsIgnoreCase("Airline"))
    partnerHostingMast.setPartnerCode(partnerMast.getPartnerCode());
    partnerMastService.save(partnerMast);     /* To be noted */
    partnerHostingMastService.saveOrUpdate(partnerHostingMast);
    ret_stat = "Success";
    context.getExternalContext().getSessionMap().put("partnerMast", null);
    } else {
    partnerMastService.save(partnerMast);
    ret_stat = "Success";
    }catch(Exception e){
    ret_stat = "Error";
    FacesMessage message = new FacesMessage("Application facing some problem - Please contact administrator");
    context.addMessage("error", message);
    return ret_stat;
    My Dao :
    public PartnerMast save(PartnerMast entity){
    try{
         System.out.println("Calling Save Method.............");
         entity.setIsActive("Y");
         getHibernateTemplate().save(entity);
         System.out.println("Record Saved..............");
    catch(ConstraintViolationException e){
         System.out.println("Exception ..................."+e);
    return entity;
    I hope u got my question. Is there is any solution for this.
    Pls Anyone help me out.
    Thanks,
    Ambika&#9786;

    Hi,
    I am able to catch the exception, how would i able to display the message in the JSF UI.
    My Controller:
    public String addAction() throws Exception
    try{               
    partnerMast = (PartnerMast)context.getExternalContext().getSessionMap().get("partnerMast");
    partnerHostingMast = (PartnerHostingMast) context.getExternalContext().getSessionMap().get("partnerHostingMast");
    this.getService();
    if(partnerHostingMast != null && partnerHostingMast.getHostingPartner() != null && partnerMast.getPartnerType().equalsIgnoreCase("Airline"))
    partnerHostingMast.setPartnerCode(partnerMast.getPartnerCode());
    partnerMastService.save(partnerMast);     
    partnerHostingMastService.saveOrUpdate(partnerHostingMast);
    ret_stat = "Success";
    context.getExternalContext().getSessionMap().put("partnerMast", null);
    else {
    partnerMastService.save(partnerMast);
    ret_stat = "Success";
    catch(Exception e) {
         ret_stat = "Error";
         FacesMessage message = new FacesMessage("Application facing some problem - Please contact administrator");
         context.addMessage("error", message);
           if(causedByBatchUpdateException(e)) {
                  System.out.println("Yes Exception.........");
                  FacesMessage message1 = new FacesMessage("Duplicate Entry...........");
              context.addMessage("error", message1);
                            //ret_sta="NO";
                     } else {
                             throw e;
              System.out.println("Before returning.............");
              return ret_stat;
              //return ret_sta;
    }It is displaying the message saying "Yes Exception" in the console but not displaying the "Duplicate Entry" in the JSF UI.
    Pls Anyone help me out.
    Thanks,
    Ambika&#9786;

  • Clicking on any row in a record set

    How can I click any where in a row and retrieve that records data in a report. I know how to highlight a row. Any help would be appreciated.
    Thanks
    Aron

    Hi Scott,
    I read your post. and I am able to go to another page when you click a row. that is fine. my real problem is i have a report say with 10 columns. so the user has to scroll all the way to the other side. when they are in the first column and select a particular row that is highlighted, but when they scroll that highlight disappears and they wont really know which row they were in when they selected the 1st column say.
    <BR> so what the user wants is highlight the whole row so that they will be able to know on which row they are in even when they scroll. (this is actually like a LOV screen, but they really want to highlight the row they are in, and have the flexibility to highlight another row and scroll to the last column if they have to)
    Thanks
    Knut

  • How to display records in jsp

    i have 100 records can anybody tell me how i display records 10 at atime in jsp & by clicking the next button another 10 records displays in the same jsp. How i can do that thing.

    You have to implement a page breake yourself.
    Simple scenario would be to store a page number into a session:
    session.setAttribute("page", selectedPage)
    every time user clicks on a next page link
    When displaying the record read the page and display only those which should be on the page
    Integer selectedPage = session.getAttribute("page")
    if (selectedPage == null) selectedPage = 1;
    //display code goes here

  • How to display records when clicking button in alv

    I am using screen painter to create two buttons
    'classical' and 'alv'.
    When i click the first button control should move to
    corresponding classical program.Evan i got the answer
    I am not able to display the "select-options button" in the
    output as in classical report program.
    It displays all records instead of selecting particular records from select-option button.
    So how to display the select option button(i.e in the classical view program) while "clicking the classical button " .
    plz send me the coding....

    hi,
    try this.
    SELECTION-SCREEN BEGIN OF SCREEN 100.
    SELECT-OPTIONS : EBELN FOR V_EBELN MODIF ID G1,
                     VBELN FOR V_VBELN MODIF ID G2.
    SELECTION-SCREEN END OF SCREEN 100 .
    PAI.
    module mod_name.
    case sy-ucomm.
    when 'BUTT!'.
    call selection-screen 100.
    when 'BUTT2'.
    """"your ALV logic"""".
    endcase.
    endmodule.
    if...any doubts revert back.
    Regards
    Sandeep Reddy

  • Swing button to insert row in displayed table records set

    Hi,
    I have been trying to insert custom row by pressing button in Swing form, this row should be displayed as last record in the records set fetched from table shown in the Swing form, can I have a help on this.
    cheers.

    Hi,
    the way you do this with ADF is to create an action binding for the ViewObject's CreateInsert operation. You do this in the pageDef file. Then from teh button, you use the panelBinding object to execute that method. Get access to the iterator binding and fill in the infromation you want to add. Then commit the change.
    If i find time I'll blog an example at orablogs.oracle.com/fnimphius
    Frank

  • On Button click change the button display text from LOCK to UNLOCK

    Hi Freinds,
    I am rendering a TreeByNestingTableColumn with two columns  like:  Name , Status as below shown. In The status column I inserted a Table Cell editor Button type and  the button element property text mapped to the context attribute called statusButton and set the button name in the code to display as LOCK. When the tree renders all the vales are displaying in status column as LOCK. Now whrn the user click on LOCK i should fire the event and change the button text from LOCK to UNLOCK. The same way when they click on UNLOCK and i have change to LOCK. please help how to do this.
       Name                          Status
    |> Employee1------------------LOCK (when i click on lock  button here, his and under neath of him button status should                 
            |>Employee2-----------LOCK    change from LOCK status to UNLOCK)                                                     
                   |>Employee3----LOCK
    Thanks in advance.
    Thanks
    Srini

    Armin,
    Yes I removed the method and created the calicualted value as you suggested and I able to get the out put what i have asked.
    My complete scenario is some thing like this, i able to complete upto certain level but not able to make it work for complete scenario, I appreicate your comments or advice for getting me the below output
    I have a TreeByNestingTableColum UI rendering with three columns as NAME(node |>), STATUS(Toggle Button) and PLANNING (Text view)  (developed based on sample tutorial Integration of a Tree Structure in a Web Dynpro Table.pdf)
    I am trying to get this output:
    From the sap backed i am getting flag value, based on that i have to render Tree UI columns NAME,  STATUS(Toggle Button) and PLANNING (Text view). if the flag is null i have to show as LOCK and In Planning else Unlock and Submitted  (please see the below picture for clear idea)*
    if (statusflag = ""){
    i have to show values in two columns like Lock ...Planning
    } else
    show values in two columns like Un Un Lock ...Submitted
    One more thing is , If i lock a record at secound node level , then all the records should locked underneath of that node (it could be 2 nodes or 10 nodes) and then the status column values should change from lock to Unlock and Planning column values should change from In Planning to Submitted. where as when i Click on Unlock , only that perticular record (not node level) should changed from unlocked to Lock and planning is  from Submitted to In Planning.
    This is the functionality actually I am looking for.
    Here the tree sample:
    Name                        Status              Planning
    |>M1                         Lock                 In Planning
       |>M2                      Lock                 In Planning
         *M2a                    Lock                 In Planning
       |>M3                    Un Lock                Submittd
    Thank you.
    Srini

  • How to display records with radio buttons

    Well,
    <b>This is what I have right now:</b>
    When I execute  the Sales Orders report, it takes me to a selection screen with fields (VBELN, AUDAT, UNAME,....). I have Display, Create and Edit buttons below the selection criteria. The database table will have a DELETE FLAG.
    <b>This is what I need to do:</b>
    When I click on Edit button, it should take me to a new screen (this screen will have 3 buttons: Change, Delete, Undelete) with records based on the selection criteria. Also each record should have radio button.
    So if I select a record and <u>click on CHANGE</u> button it should take me to a new screen with only that record and the fields should be editable. Upon changing the fields, the records should be updated in the database.
    If I <u>click on DELETE</u> button it should set the DELETE FLAG in the database, so that when I click on Display button in main screen it shouldn't show me this record next time.
    If I <u>click on UNDELETE</u> button it should reset the DELETE FLAG.
    <b>This is what you get:</b>
    Reward points if helpful

    You can use AT SELECTION-SCREEN OUTPUT event to capture the dynamic screen changes like selecting the radio buttons, once you captured the user action then you can call the other screen and you can work on that.
    regards,
    Dj
    reward, if its useful

  • Display the fullname without clicking on the button in this tutorial

    Hello,
    I am referring to this tutorial : Zeeshan Baig's Blog: Calling PL/SQL Procedure and Function in Oracle ADF application
    1) I would like the fullname to be displayed automatically after the employee id is input ,without having to click the getEmpFullName button.
    2) I would like to copy the fullname value to an entity attribute and save in db .
    Is that possible please ? Thanks.

    Thanks  931325 , I want to use the tutorial link that you sent me .
    Step1 : Define the application module method in respective page definition as shown in below screen shot 
    Step2: Write the below code in backing bean to invoke application module method
    Note : I have done step 1 , my method is already in page definition. How do you implement step 2 . 
    public void ot2_attributeChangeListener(AttributeChangeEvent attributeChangeEvent) {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application app = facesContext.getApplication();
    ExpressionFactory elFactory = app.getExpressionFactory();
    ELContext elContext = facesContext.getELContext();
    ValueExpression valueExp =
    elFactory.createValueExpression(elContext, "#{bindings}", Object.class);
    BindingContainer binding= (BindingContainer)valueExp.getValue(elContext);
    OperationBinding operationBinding=binding.getOperationBinding("createCurrentCustomerRow");
    // Set the Input parameters to the operation bindings as below
    operationBinding.getParamsMap().put("pCustomerID", "100"); 
    // Invoke the Application module method
    operationBinding.execute();
    // Get the result from operation bindings
    Object obj =operationBinding.getResult()
    Thanks

  • Not able to see No of BP records in a profile when I click on Count button

    Hi All,
    We are working on CRM 5.0, BP segmentation.
    We have created a Attribute list which is the combination of Infoset and Attribute Set.
    Now we want to build the profile in Segment builder by using Attribute list.
    I created a profile ( using the filters of attribute set and Info set) I am not able to see the BP records when I click on count button by selecting the corresponding profile.
    But When I have created defferent profiles by using the filters of attribute set and info set  seperately I am able to see the no.of BP records when I click on Count button for the corresponding profile.
    Can anybody advice me what is the reson for that?
    and I want to see the No.of BP records for the profile which is build with the combination of attribute set and Info set.
    Thanks in advance.
    -Madhu.

    Hi sachin,
    I am extremely sorry to keep this thread as open. This problem is already solved.
    I have used table views in infoset to get the data which is coming from multiple tables.
    Regards,
    Madhu.

  • I want to add a Saved Mailbox, but I do not have an Edit button for Mailboxes?  Is there a setting that causes the Edit button to display?

    The user manual says to go Mailboxes and click the Edit button to add a Mailbox, but I do not have an Edit button displayed in Mailboxes.  Is there a setting for displaying the Edit Button?  I have the latest version of iPad (Model MD328LL).  Thanks.

    If you go to your email account in the Mail app and look at the window where your inbox, trash folder and sent folder are - if there is an Edit button at the top of the window - tap that and then tap Add Mailbox at the bottom.
    If the Edit button is not there - you cannot create folders on the iPad. Your email account is not IMAP. Only IMAP email accounts can create folders on the iPad. Any folders that you would already have in an IMAP account would sync to the device as well.

  • Displaying a set of records using jstl

    hi i am new to jstl.my requirement is i want to display a set of records from my database using jstl.for eg i want to display 50 records per page and i want to navigate to other records using next and prevoius buttons and i need to put view and edit buttons in that page.can anybody give me a solution for this.urgent

    You may try the paging taglib ...
    http://www.servletsuite.com/servlets/pagertag.htm

  • Click on jsp page Display records on another html page

    Hi All,
    I am new in jsp. I am making discussion forum. I have one jsp page "Post.jsp" I want when I clicked on submit button on jsp page all records display on html page "index.html". Plz. help me.
    Raj

    I have a html page (index.jsp) and a jsp pages (post.jsp) in Post.jsp page three fields: Id, Sub, message and submit button.
    I want when i click on submit button of post.jsp page then store in database and display these records on index.html.

  • How to set the time in messageTextInut when i am click the submit button

    Hi
    In my form one messageTextInput field and submit button .when i am click the submit button the time (continuously)display in messageTextInput field.so plz tell me the process.

    You can associate a VO Attribute to the textinput field and set its value when the Submit button gets clicked. Thereafter you can renavigate to the same page.

  • Old values are displayed when i click the back button of the browser

    Hi all,
    I am having a INPUT screen having 2 textfields and a "Confirm" button. When user enters values in these textfields and clicks on "Confirm" button, another CONFIRMATION page is displayed where these values are just displayed as h:outputText. But when user clicks the back button of the browser previosly entered values are getting displayed in the INPUT screen. My question is how to remove these values or set to null on click of the Back button of the browser?
    Thanks in adv.

    Hi,
    i believe this should handle the browser. For instance, you have to tell him with meta tags, not to cache the website. Until yet I didn't succeed in doing so!
    With kind regards,
    Lutz Steinfeld

Maybe you are looking for