Keeping session using custom save button in managed bean

Greetings,
I'm building a application based on BC + ADF(JSF).
All around the app. I need two buttons, one for committing and actualizing the UI data, and other to return to the previous page.
Instead of customizing those buttons every time they occurs, I've haded a managed bean to do the work. This managed bean as "request" scope.
The process of editing a form, requires me to have one form to only view the data and other to edit the data.
The issue is: when saving a form, it should return ("back" action) to his precedence, keeping the session state.
That is: If I'm editing "process 2" when i commit it should go to "process 2" in read only mode.
This works fine if i use "hardcoded buttons", but when i use the managed bean to handle those buttons action, when committing, it goes to the first on the list. It doesen't keep the session state.
How can i keep the state ?
Thanks
here it is the managed bean:
package fc.view.backing;
import fc.model.FirstCareAppModuleImpl;
import javax.faces.context.FacesContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.view.faces.component.core.nav.CoreCommandButton;
import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;
import oracle.jbo.ViewObject;
public class fcLib {
private BindingContainer bindings;
private CoreCommandButton commandButton_save;
private CoreCommandButton commandButton_backOnePage;
private CoreCommandButton commandButton_backHome;
* Get and set bindings
public BindingContainer getBindings() {
return this.bindings;
public void setBindings(BindingContainer bindings) {
this.bindings = bindings;
* Getters ans setters for "save" and "back" buttons
public void setCommandButton_save(CoreCommandButton commandButton_save) {
this.commandButton_save = commandButton_save;
public CoreCommandButton getCommandButton_save() {
return commandButton_save;
public void setCommandButton_backOnePage(CoreCommandButton btn) {
this.commandButton_backOnePage = btn;
public CoreCommandButton getCommandButton_backOnePage() {
return commandButton_backOnePage;
public void setCommandButton_backHome(CoreCommandButton btn) {
this.commandButton_backHome = btn;
public CoreCommandButton getCommandButton_backHome() {
return commandButton_backHome;
* Back actions for back buttons
public String commandButton_backOnePage_action() {
return "back";
public String commandButton_backHome_action() {
return "home";
* Save button action - Used in al pages that do save (commit) data
public String commandButton_save_action() {
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("Commit");
OperationBinding operationBinding2 = bindings.getOperationBinding("Execute");
operationBinding.execute();
operationBinding2.execute();
// It should be a error page
if (!operationBinding.getErrors().isEmpty()) {
return null;
// Refresh main view object
DCBindingContainer bc = (DCBindingContainer)FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get("bindings");
FirstCareAppModuleImpl fc = (FirstCareAppModuleImpl)bc.findDataControl("FirstCareAppModuleDataControl").getDataProvider();
ViewObject vo_SitSocProf = fc.findViewObject("EpisodiosMain");
vo_SitSocProf.executeQuery();
System.out.println(" All done. Ciao ");
return "back";
}

Hi
I re-execute the query only to refresh the AM VO data.
I'm using AM EO to access DB Views, that use IOF triggers to update/insert/delete into the DB.
Using the application, when updating data, changes wont reflect in the UI if I don't refresh the "master" VO, that is "EpisodiosMain". I'm doing a commit and a execute to a "detail" VO.
"If you need to execute the query and set it back to the last row you worked with, get the row key before executing the query so you can set the current row back to this rowkey"
Could you please throw a example on how to do this ?
"Reaching through to the AM to execute the VO isn't best practices. You should grap the associated iterator in teh binding instead and perform the execute operation. Note that usig ADF binding there are only rare situations in which you need to access teh business service directly as you do. "
Again, could you please post an example of how to do this, or introduce me to some documentation.
Thanks
Message was edited by:
Buondi

Similar Messages

  • Requery Condition with custom save button.

    Hi,
    I've set the 'Requery Condition' for my group equal to 'After Commit' and it doesn't seem to refresh my page when I do a commit using a custom button bound to my method in the managed bean.
    Do I need to do anything extra in my bean where I am committing the record in order to make the 'Requery Condition' work on my group ?
    Thanks,
    Shishir

    Hi,
    It depends on your version of JHeadstart what is happening with the Save functionality. In general, you should 'copy' whatever JHeadstart is doing.
    In my 10.1.3 version, it executes the action 'Commit' and the actionListener '#{bindings.Commit.execute}'. So indeed, try to execute the Commit binding as HJHorst told you, which should cause the onCommit functionality in the JHeadstart PageLifecycle class to fire and set the #{jhsAfterCommit} we were talking about before.
    Take a look at the JhsPageLifecycle class, onCommit function and you know what I will mean. This class 'captures' commit functionality, which will not be captured if you simply call getDBTransaction().commit().
    Regards
    Evert-Jan de Bruin

  • JQuery Custom Save Button - Save, Validation, and Redirection Issues

    We have a custom list form that we are trying to save, validate, and redirect. We can get the button to save and validate, but not redirect. And vice versa. We have tried several variations on the lines in red, all with either
    no save or no redirect. We are also using this custom list form on a custom master page.
    Is there something that we are doing wrong?
    <script>
    $(document).ready(function() {
        var button = $("input[id$=SaveItem]");
        // change redirection behavior
            button.removeAttr("onclick");
            button.click(function() {
                var elementName = $(this).attr("name");
                var aspForm = $("form[name=aspnetForm]");
                var oldPostbackUrl = aspForm.get(0).action;
                var currentSourceValue = GetUrlKeyValue("Source", true, oldPostbackUrl);
                var newPostbackUrl = oldPostbackUrl.replace(currentSourceValue, "custompageurl.aspx")
                if (!PreSaveItem()) return false;
                                                    if (SPClientForms.ClientFormManager.SubmitClientForm('WPQ1')) return false;
                                                    if (!Page_ClientValidate()) return false;
                                                    WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(elementName, "", true,
    "", newPostbackUrl, false, true));
    </script>

    Hi,
    From your description ,my understanding is that you want to redirect to your custom page after you create a new item.
    You could accomplish you requirement via sessionvars.js file, please refer to this article:
    http://spjsblog.com/2009/09/04/redirect-from-newform-to-editform-or-custom-page/
    Here is a similar case for reference:
    https://social.technet.microsoft.com/Forums/office/en-US/b2b70571-d8bf-4633-9ed4-99f4ee40fdc3/redirect-to-a-home-page-when-on-click-of-save-button-in-a-discussion-forum-thread?forum=sharepointdevelopmentprevious
    Best Regards,
    Vincent Han
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Using custom classes that are not beans

    Hi folks,
    Is it possible to use java classes that are not beans. I mean, on a page, could you say Customer cust = new Customer("Jones", 25);
    if you had a Customer class with a constructor that took a name and age (String and int).
    If so, how do you go about this- do you need to import the class, or put it in a standard location? I'm using Tomcat, and would guess that this would go in WEB-INF/classes?
    I hope it's not a stupid question, all the literature seems to be focused on JavaBeans
    Any advice on this would be great!

    Beans are used as putting Java code into a JSP is generally considered bad practice. The advantage of the bean pattern is that you use things like:
    <jsp:setProperty name="laBean" property="someSetter" value="someValue" />so that you aren't embedding Java directly into the JSP. I'm not very religious about this particular topic personally and will throw a line or two in here and there.
    Having said that though, you can easily use any Java class in a JSP. You'll have to import it first:
    <%@ page import="java.util.*" %>And then you can easily use it like in a real Java program.

  • Unable of keep session using url rewriting tomcat

    Hi everybody,
    I have an application which communicates with a servlet. I am trying to use session tracking for my midp application with the url rewriting technique because of simplicity. I have tomcat 4.0.3 and MIDP 2.0. I had forced the use of url rewriting including this line into the server.xml file from tomcat:
    <Context path="/webappname" debug="0" cookies="false" docBase="webappname"/>
    This should force url rewriting, but when i call the method encodeURL in my servlet i only get a void
    string. I know this isnt the best forum for this, but i have to try ;-). Any suggestion? all comments will be wellcomed, but please i dont want to use cookies and the rms api.
    Thanks.

    Are you aware that the MIDlet's networking won't support cookies or redirections automatically, and that you have to code that yourself: reading the "set-cookie" header and saving it for later, or catching redirection response codes (3xx) and changing the url accordingly?
    Check out these tutorials:
    http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-wireless.html
    http://developers.sun.com/techtopics/mobility/midp/articles/servlets/
    shmoove

  • HCM ECM Budget Upload using Custom Import button

    How does the BAdi HRECM00_BDG0001 (Initialize Budget Values) work in regards to using the u201CCustom Importu201D button?  More specifically, how does it work when trying to upload a spreadsheet or external source?  The BAdi does not allow the call to FM u201CGUI_UPLOADu201D or any selection screens or a call to the F4 FM to find a file on a desktop, etc.
    Any help is appreciated.

    Nachy & others,
    I get a runtime error when using the class as follows:
    Error when processing your request
    What has happened?
    The URL https://aaaaaa99.aaa.com:9999/sap/bc/bsp/sap/hrecm_bdg_maint/main.do was not called due to an error.
    Note
    The following error text was processed in the system  : Exception condition "NOT_SUPPORTED_BY_GUI" raised.
    The error occurred on the application server and in the work process 1 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: FILE_EXIST of program CL_GUI_FRONTEND_SERVICES======CP
    Function: GUI_UPLOAD of program SAPLSFES
    Method: GUI_UPLOAD of program CL_GUI_FRONTEND_SERVICES======CP
    Method: IF_EX_HRECM00_BDG0001~DETERMINE_BUDGET_VALUES of program ZCL_IM_HR_MSS_ECM_BUDGET======CP
    Method: IF_EX_HRECM00_BDG0001~DETERMINE_BUDGET_VALUES of program CL_EX_HRECM00_BDG0001=========CP
    Function: HR_ECM_BUDGET_USER_EXIT of program SAPLHRECM00BUDGETSTRUC
    Method: DO_CUSTOM_IMPORT of program CL_HRECM00_BSP_BDG_DETAILS====CP
    Method: DO_HANDLE_EVENT of program CL_HRECM00_BSP_BDG_DETAILS====CP
    Method: IF_BSP_CONTROLLER~HANDLE_EVENT of program CL_BSP_CONTROLLER2============CP
    Method: DISPATCH_INPUT of program CL_BSP_CONTROLLER2============CP

  • How to download splist item attachment using custom ribbon button

    Hi All,
    I have a requirement to download sp list items attachments in a zip format to file share. Is there a way to do this? please do let me know.
    Your quick turnaround is much appreciated
    MercuryMan

    Hi,
    According to your post, my understanding is that you want to download list items attachments in a zip format to file share.
    You can create custom ribbon action.
    More information:
    SharePoint 2010 Download as Zip File Custom Ribbon Action
    Download files as Zip File in SharePoint
    Create a SharePoint Custom Action to Zip and Download a Document Set
    Thanks,
    Linda Li                
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

  • Calling a button from managed bean

    Hi,
    I have two jspx page. First jsp calling second jsp through the taskflow. Once the user click on the button in the second jsp, backing bean method submitApproval is being called, where I using the below code to invoke a command button ctb1 available on the first jspx.
        public String submitApproval() {
            System.out.println("---- Approve Button Id --"+resetButton);
            ActionEvent actionEvent = new ActionEvent(resetButton);
            actionEvent.queue();
           return null;
    resetButton is binding to the command button ctb1 on the first jsp. At runtime, I could check from the logs, its printing the correct component id of the command button ctb1.
    But still the method defined in the action of the command button is not getting called/executed
    Is the above approach fine ?
    Regards,
    Stalin

    User, please tell us your jdev version!
    No, you can't call an action in the other page add the page is not loaded at the time you queue the action. Next thing is that you can't call an action outside the task flow.
    For this you can use a parent action.
    Timo

  • Generate PDF using Managed Bean with custom HTTP headers

    Background
    Generate a report in various formats (e.g., PDF, delimited, Excel, HTML, etc.) using JDeveloper 11g Release 2 (11.1.2.3.0) upon clicking an af:commandButton. See also the StackOverflow version of this question:
    http://stackoverflow.com/q/13654625/59087
    Problem
    HTTP headers are being sent twice: once by the framework and once by a bean.
    Source Code
    The source code includes:
    - Button Action
    - Managed Bean
    - Task Flow
    Button Action
    The button action:
    <af:commandButton text="Report" id="submitReport" action="Execute" />
    Managed Bean
    The Managed Bean is fairly complex. The code to `responseComplete` is getting called, however it does not seem to be called sufficiently early to prevent the application framework from writing the HTTP headers.
    HTTP Response Header Override
    * Sets the HTTP headers required to indicate to the browser that the
    * report is to be downloaded (rather than displayed in the current
    * window).
    protected void setDownloadHeaders() {
    HttpServletResponse response = getServletResponse();
    response.setHeader( "Content-Description", getContentDescription() );
    response.setHeader( "Content-Disposition", "attachment, filename="
    + getFilename() );
    response.setHeader( "Content-Type", getContentType() );
    response.setHeader( "Content-Transfer-Encoding",
    getContentTransferEncoding() );
    Issue Response Complete
    The bean indirectly tells the framework that the response is handled (by the bean):
    getFacesContext().responseComplete();
    Bean Run and Configure
    public void run() {
    try {
    Report report = getReport();
    configure(report.getParameters());
    report.run();
    } catch (Exception e) {
    e.printStackTrace();
    private void configure(Parameters p) {
    p.put(ReportImpl.SYSTEM_REPORT_PROTOCOL, "http");
    p.put(ReportImpl.SYSTEM_REPORT_HOST, "localhost");
    p.put(ReportImpl.SYSTEM_REPORT_PORT, "7002");
    p.put(ReportImpl.SYSTEM_REPORT_PATH, "/reports/rwservlet");
    p.put(Parameters.PARAM_REPORT_FORMAT, "pdf");
    p.put("report_cmdkey", getReportName());
    p.put("report_ORACLE_1", getReportDestinationType());
    p.put("report_ORACLE_2", getReportDestinationFormat());
    Task Flow
    The Task Flow calls Execute, which refers to the bean's `run()` method:
    entry -> main -> Execute -> ReportBeanRun
    Where:
    <method-call id="ReportBeanRun">
    <description>Executes a report</description>
    <display-name>Execute Report</display-name>
    <method>#{reportBean.run}</method>
    <outcome>
    <fixed-outcome>success</fixed-outcome>
    </outcome>
    </method-call>
    The bean is assigned to the `request` scope, with a few managed properties:
    <control-flow-rule id="__3">
    <from-activity-id>main</from-activity-id>
    <control-flow-case id="ExecuteReport">
    <from-outcome>Execute</from-outcome>
    <to-activity-id>ReportBeanRun</to-activity-id>
    </control-flow-case>
    </control-flow-rule>
    <managed-bean id="ReportBean">
    <description>Executes a report</description>
    <display-name>ReportBean</display-name>
    <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    The `<fixed-outcome>success</fixed-outcome>` strikes me as incorrect -- I don't want the method call to return to another task.
    Restrictions
    The report server receives requests from the web server exclusively. The report server URL cannot be used by browsers to download directly, for security reasons.
    Error Messages
    The error message that is generated:
    Duplicate headers received from server
    Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple distinct Content-Disposition headers received. This is disallowed to protect against HTTP response splitting attacks.Nevertheless, the report is being generated. Preventing the framework from writing the HTTP headers would resolve this issue.
    Question
    How can you set the HTTP headers in ADF while using a Task Flow to generate a PDF by calling a managed bean?
    Ideas
    Some additional ideas:
    - Override the Page Lifecycle Phase Listener (`ADFPhaseListener` + `PageLifecycle`)
    - Develop a custom Servlet on the web server
    Related Links
    - http://www.oracle.com/technetwork/middleware/bi-publisher/adf-bip-ucm-integration-179699.pdf
    - http://www.slideshare.net/lucbors/reports-no-notes#btnNext
    - http://www.techartifact.com/blogs/2012/03/calling-oracle-report-from-adf-applications.html?goback=%2Egde_4212375_member_102062735
    - http://docs.oracle.com/cd/E29049_01/web.1112/e16182/adf_lifecycle.htm#CIABEJFB
    Thank you!

    The problem was that the HTTP headers were in fact being written twice:
    1. The report server was returning HTTP response headers.
    2. The bean was including its own HTTP response headers (as shown in the question).
    3. The bean was copying the entire contents of the report server response, including the headers, into the output stream.
    Firefox ignored the duplicate header errors, but Google Chrome did not.

  • New to using workspace - Save as Draft button

    Background work:
    1.  I have a separate process that generates a pdf document to be used by a team member.  These files is saved to a network drive.  It takes to long to generate the document dynamically.
    2.  Within workspace, I have a start process card that displays a form to enter member id and state.  This form displays the "save" and "complete" buttons.  Fill in the info and select "complete".
    3.  This starts the process to assign a task to the team member.  It goes out to the network drive and gets the correct pdf document to be used for the application.  It is assigned to a document variable.  The task uses this document variable as the User Interface for the task. 
    4.  The team member goes out to the queue and starts the task.
    5.  The pdf document opens correctly within workspace.
    The issue I have is that it doesn't have a "Save" button to save the document in the drafts folder.  How do I enable this feature or get it to work correctly?
    PDF document Info:
    Able to save locally using the save button within reader.  There is no save or submit button on the forms.
    I believe it uses reader extentions.
    A packet of several forms with heavy use of javascript.

    I think you need to check the Reader Extension on your fomr. Below post also talks about the same:
    http://forums.adobe.com/thread/775021
    Regards,
    Varun Nohria

  • How can I write a code that triggers when clicking on Save button

    I want to hide certain fields inside my tracking list, if the login user is not part of the “Managers” group.
    To do so I want to add the following Page-load code inside a web part :-
    using (SPSite site = new SPSite(SPContext.Current.Site.Url))
    using (SPWeb web = site.OpenWeb())
    {SPGroup group = site.Groups["Managers"];
    bool isUser = site.IsCurrentUserMemberOfGroup(group.ID);
    if (isUser)
    {textbox.Visible=false;}}
    And the following custom code that triggers when saving the form :-
    using (SPSite site = new SPSite(SPContext.Current.Site.Url))
    using (SPWeb web = site.OpenWeb())
    SPList list = web.Lists["ListName"];web.AllowUnsafeUpdates = true;
    SPListItem item = list.Items[SPContext.Current.ListItem.UniqueId];
    txtTitle.Text = item["Title"] as string;item.Update();web.AllowUnsafeUpdates = false;
    But I am not sure where exactly I should add the custom code for the save button ? I tried writing it inside the Oninit method , but I got many errors as shown below:-
    So can anyone advice how i should write the web part to include the Page load & the custom save button code?
    second question in general is my above approach considered valid , i mean to hide/show list columns using web parts ?

    Hi,
    According to your post, my understanding is that you want to hide/show list columns based on specify the permission for Users, SharePoint Groups or Active Directory Groups.
    Here is a solution from CodePlex for your reference:
    SharePoint 2013 Column & View Permission
    https://sp2013columnpermission.codeplex.com/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • How to add save button in ButtonControl.vm same as submit button?

    Hi,
    I want to add save button in ButtonControl.vm and also need to save the current page data into siebel using the save button.
    how to add type,name and how to get event handler in java for the input type for save

    Using the version of OPA Web Determinations that ships with OPA Connector for Siebel 10.2 or later, the save button will persist the current Web Determinations data to the Siebel OPA WD session tables.
    Davin.

  • Customer exit for Batch management

    Hi experts,
    I'm using customer exit for batch management for internal number assignment.
    I need the Batch number as i mentioned below 
    DDMMYYB01
    DD-Date
    MM-Month
    YY-Year
    B-Block
    01-Number
    For this i need to give logic. How to give i'm not getting. This batch number creation will come at the time of GR.
    Anybody help me?
    Naren

    Hi
    Please use the user exit SAPLV01Z as I mentioned in your other thread, please go to SMOD to read its documentstion.
    In SMOD, select the 'Documentation' and click 'Display', this will show the overview documentation.
    Select the 'Componnet', then ciick the 'Display'. select each component and click 'Documentation Ctrl+F4) this will show the detailed documentation of them.
    Best Regards.
    Leon.

  • Does Pages 2 have a save button in the toolbar?

    Anyone know if Pages 2.0 has a save button in the toolbar? Also, is there a button to show invisibles instead of a drop down menu? This is one of the most missed features. I couldn't tell from the images.
    iBook G3 800MHz Mac OS X (10.3.9)
    iBook G3 800MHz Mac OS X (10.3.9)

    Just out of curiosity, could you describe how you use the Save button in AppleWorks?
    Do you let go of the keyboard, move your hand to the mouse, move the cursor to the button and click it and then move the hand back to the keyboard, or do you usually have your hand on the mouse anyhow, so you just have to move the cursor and click? Or do you have some other trick?
    I'm honestly curious. The first thing I do in almost any application is to turn off the toolbars and use the shortcuts instead. (⌘+S for save and ⇧⌘I for show invisibles, but you probably knew that already.)

  • Save Button on the TimeSheet Review Screen

    Hello,
    I am trying to move the Previous Step and the Save buttons on the Top of the screen above the Review Table ..I had gone to the VcCatRecordReview Component -> VcCatRecordReview View Controller and moved the Transparent Container which has those 2 buttons but it's not taking into effect...If anybody has done something like this then please let me know....
    Thanks in Advance

    Hi ,
    if you have used user_command then you just write the condition of function code of save button '&data_save' between case and endcase.
    if you need to use standard save button then go to the menu painter using tcode 'SE42' and go to function tool bar and write save on save button.
    regards..
    bibek

Maybe you are looking for