URGENT***How to chance ADF bean properties at runtime?

Hi Friends,
Please help me to get some sample java code to create the ADF UI bean object at runtime.
As per my requirement in my ADF screen (.jspx) I got 3 input text fields, where last fields 2 are disabled while loading the page. When I enter some value in the first textbox and tab out , the second one should be automatically enabled without any button click. Please help me how to achieve the same. How can I set my UI bean properties at runtime (Please share the code to get the UI object)? And how can I able to handle / know where the first text box has value or not.
This is very urgent requirement. Please help me .
Thanks
klogube

Hi,
Thanks for helping me. But so far no luck with the 3rd row enabled. Below is my code. As per my real requirement each row should have 2 columns. (col 1: choice box and col2: free textbox).
Can able to make enable the 2nd row's columns. But the last row not getting enabled. Seems the 2nd row textbox (password) value not getting populated in the managed bean. When I print the value it is showing null. (But if I totally remove the first row and enable the 2nd row then test the same. In this case 3rd row getting enabled.). So worried that after enable the 2rd row by EL, it is not passing the entered value to bean it seems.
</p>
<af:panelGroupLayout id="pone">
<af:selectOneChoice label="username choice" value="#{SearchBean.choiceone}">
<af:selectItem label="First Name" value="firstname"/>
<af:selectItem label="Last Name" value="lastname"/>
</af:selectOneChoice>
<af:inputText id="username" value="#{SearchBean.username}" autoSubmit="true" />
</af:panelGroupLayout>
</p>
<p>
<af:panelGroupLayout id="ptwo">
<af:selectOneChoice label="password choice" disabled = "#{empty SearchBean.username}" partialTriggers="username" value="#{SearchBean.choicetwo}">
<af:selectItem label="First Name" value="firstname"/>
<af:selectItem label="Last Name" value="lastname"/>
</af:selectOneChoice>
<af:inputText id="password" value="#{SearchBean.password}" partialTriggers="username" disabled = "#{empty SearchBean.username}" autoSubmit="true"/>
</af:panelGroupLayout>
</p>
<p>
<af:panelGroupLayout id="pthree">
<af:selectOneChoice label="email choice" disabled = "#{empty SearchBean.password or empty SearchBean.username}" partialTriggers="password username" value="#{SearchBean.choicethree}">
<af:selectItem label="First Name" value="firstname"/>
<af:selectItem label="Last Name" value="lastname"/>
</af:selectOneChoice>
<af:inputText id="email" value="#{SearchBean.email}" disabled = "#{empty SearchBean.password or empty SearchBean.username}" partialTriggers="password username" />
</af:panelGroupLayout>
</p>

Similar Messages

  • [Seeking help] How to create a bean with annotations @ runtime?

    I would like 2 create a bean, @ runtime, as below:
    public class A {
      @MyAnnotation(id = "ID")
      private String id = "";
      public String getId() { ... }
      public void setId(String id) { ... }
    }Can anyone tell me how 2 achieve this? I know how 2 create a bean dynamically, however with annotations it is a bit tricky ..
    Cheers!
    Edited by: olove66 on Aug 7, 2009 2:00 AM

    @_@ I guess anyone interested in this topic can turn 2 ASM. Maybe BCEL has not got anything 2 support annotation creation yet.

  • Urgent. How may i update a properties file in execution time?

    Urgent, please. How may i update a properties file in execution time? I need to update the file by means of a web page and i need the changes be reflected immediately.
    Thanks

    Note the update must be made in memory. But i don�t know how.

  • How can i reset all bean properties to their default state.

    I have a bean which i am using to store data throughout a users session until the data is extracted from the bean and put into the database at the last stage. What i would like to know is how i can reset all of my bean properties? I understand that i could go through each String property and sets its value to "" or null but there must bea an easier way. does anyone have any idea how to do this?
    Suggestions would be much appreciated.
    Thanks

    You can implement your own reset option (one methode that goes though and manually sets everything back to its original state) or you can dispose of the bean and create a new one.

  • How to update bean properties when using an immediate link

    Hello,
    I have a page with a find link next to an input text field. The input text field requires a valid code to be entered. If the user doesn't know the code they need to press the find link to go to a search page and select the code. The input text code field needs to have a value entered so it has its required attribute set because the validator I have and attached to the input text field does not get called unless something is entered in the field. If I don't set the link to immediate the required constraint prevents the search page from being invoked but if I do set it to immediate the values typed on the page are not updated to the bean properties they are bound to.
    I have read many posts but I fail to see a way to resolve this. The update model phase is apparently skipped because of the immediate attribute and so the values typed in by the user are lost.
    Please help.
    Thanks,
    Randall

    A UIInput holds the submitted value.
    When updating models it is cleared to null but when some error occurs it keeps to hold the submitted value.
    The TextRenderer uses the submitted value if the value is null.
    Therefore, you can see the submitted value is redrawn when some error occurs.
    Unfortunately, this mechanizm does not work beyond requests
    because the default application action listener always create a new viewroot based on the navigation rules.
    An general solution of your problem is not so easy.
    I think it may be to customize the action listener or the lifecycle.
    A temporal solution may be that the link action copys the submitted value to the managed-beans.

  • How to Create adf table from java bean

    Hi,
    How to Create adf table from java class (Not from ADF BC).
    Thanks
    Satya

    @vlsn -- you have to follow what shay said.
    Do the following in Model layer ::
    create a table property java class with your columns setters and getters like :
    *public class gridProps {*
    private int sno;
    private String orderNum;
    *public void setSno(int sno) {*
    this.sno = sno;
    *public int getSno() {*
    return sno;
    *public void setOrderNum(String orderNum) {*
    this.orderNum = orderNum;
    *public String getOrderNum() {*
    return orderNum;
    Create another table java class which will populate the values to your column values and return the collection :
    *public class gridPopulate {*
    private  List<gridProps> gridValues ;
    *public List<gridProps> setToGrid(ArrayList<ArrayList> valuesToSet) {*
    *if (valuesToSet == null) {*
    return gridValues;
    gridValues = new ArrayList<gridProps>();
    if(btnValue.equals("completeBtn"))
    return gridValues;
    for(ArrayList<String> tempArr:valuesToSet)
    gridProps gp = new gridProps();
    gp.setSno(Integer.valueOf(tempArr.get(0)));
    gp.setOrderNum(tempArr.get(1));
    return gridValues;
    Right click gridPopulate class and create this as data control.This class will be seen in Data control list.Under this data control,Drag the grid property collection(created earlier) to your page.Then execute your binding(gridPopulate) according to your logic.
    Thanks.(My jdev version 11.1.1.5.0)

  • How do you create beans using NetBeans 5.5?

    I am referring to http://java.sun.com/docs/books/tutorial/javabeans/nb/index.html and I'm sorry but I can't follow any of this!
    I have NetBeans IDE 5.5 and I am trying to learn how to write beans using NetBeans, and the lessons involve things I can't find or understand, for example:
    re: http://java.sun.com/docs/books/tutorial/javabeans/writingbean/index.html
    <blockquote>
    Load the JAR file. Use the NetBeans IDE GUI Builder to load the jar file as follows:
    1. Start NetBeans.
    2. From the File menu select "New Project" to create a new application for your bean. You can use "Open Project" to add your bean to an existing application.
    3. Create a new application using the New Project Wizard.
    4. Select a newly created project in the List of Projects, expand the Source Packages node, and select the Default Package element.
    5. Click the right mouse button and select New|JFrameForm from the pop-up menu.
    6. Select the newly created Form node in the Project Tree. A blank form opens in the GUI Builder view of an Editor tab.
    7. Open the Palette Manager for Swing/AWT components by selecting Palette Manager in the Tools menu.
    8. In the Palette Manager window select the beans components in the Palette tree and press the "Add from JAR" button.
    9. Specify a location for your SimpleBean JAR file and follow the Add from JAR Wizard instructions.
    10. Select the Palette and Properties options from the Windows menu.
    11. Expand the beans group in the Palette window. The SimpleBean object appears. Drag the SimpleBean object to the GUI Builder panel.
    </blockquote>
    Sorry, you lost me literally after "Start NetBeans", the rest is Hungarian. I can't find "New Project Wizard"; I can't find "List of Projects", I can't find anything they are talking about nor do I know if any of this is relevant toward my learning how to write beans.
    Re: http://java.sun.com/docs/books/tutorial/javabeans/properties/properties.html
    "Inspecting Properties" seems impossible to do because the Inspector Window only shows a closed folder and nothing else ever. I can't figure out this part of the tutorial either.
    Can someone please explain this 3rd-grade-level to me: How to create a bean using NetBeans?
    Thanx
    Phil

    Phil,
    Before you embark on another very frustrating advanture using NetBeans, please go t hrough the NetBeans tutorial. The "New Project Wizard" is just select from the menu options -- "New Project". The "Hungarian" as you put it will not get better until you spend some time learning NetBeans. Learning something new, like beans, is frustrating enough, but to try to do it and use a tool that is not familiar may be beyond many individuals frustration level.
    Les

  • How can we change the properties of a seeded item in OAF !!!

    Hi All Gurus!
    I have a seeded item (Button 'Apply') on an Add attachement page provided by Oracle in Self Service Web Module. Oracle documentation says this:
    If you want changes to the Attachments table or page to commit automatically, without requiring a user to select Apply in the base page, you can turn on "auto-commit" by setting the Automatic Save property to True for the attachmentLink, attachmentTable, or attachmentImage item.With "auto-commit" turned on, each action ("Add", "Update", "Detach") performed by the user in the Attachments table or page is automatically committed.
    Q1) How we can see the properties of the seeded items?
    Q2) How we can turn on the personalization pencil button of an item that is disabled by Oracle development team?
    Please let me know how we can achieve this through self-service personalization. Any light on this.
    Thanks in advance!
    John
    Message was edited by:
    jtom

    You donot need to do anything on the Add Attachment page. The autoCommit feature is exposed as a property on the Attachment bean. You need to extend the controller in the base page where the attachment Image, Link is present and get a handle to the attachmentBean and call setAutoCommit(true) which will enable automatic saving.Use personalizations to modify the controller class property on the base page. You can later choose to remove the Save button on base page using personalization.

  • JSP can't  "see" bean properties

    I am trying to populate my JSP form inputs using a bean. I know the bean properties are being set, but for some reason they are not being passed to my form inputs. The bean properties are being set by a worker class just prior to hitting the JSP that segment follows. I think I may have a scope problem. Any help/thoughts would be greatly appreciated.
    <HTML>
    <HEAD>
    <TITLE></TITLE>
    <jsp:useBean id="codin" class="edu.cod.CodIn" scope="application" />
    </HEAD>
    <BODY>
    <form action='codapp' method='post'>
    <input type='hidden' name='postedFrom' value='studentInsert'>
    <br>
    student id: <input type='text' name='student_id' size='5' maxlength='5' value='<%= codin.getStudent_id() %>'>
    <br>
    last name: <input type='text' size='18' name='last_name' value="<%= codin.getLast_name() %>">
    <br>
    first name: <input type='text' size='16' name='first_name' value="<%= codin.getFirst_name() %>">
    ~
    ~
    ~
    ~
    ~
    <br>
    <input type='submit' value='submit'>
    </form>
    </BODY>
    </HTML>

    Here is a cod segment from my servlet. In it I am instantiating the bean, then setting the bean properties. If the bean is successfully populated, the gotoPage method returns to the studentInsert.jsp page. I would like to carry the name and ID fields back to the JSP so that the user doesn't have to re-key these fields to enter additional hours for the same individual. I am fairly certain the scope would only need to be request, however I'm sure how it's done.
    if ( postOperation.equals("studentInsert") )
    CodInsert codin = new CodInsert();
    codin.setStudent_id(request.getParameter("student_id"));
    codin.setFirst_name(request.getParameter("first_name"));
    codin.setLast_name(request.getParameter("last_name"));
    codin.setAi_code(request.getParameter("ai_code"));
    codin.setAi_date(request.getParameter("ai_date"));
    boolean successfulInsert = codin.doTheInsert();
    if (successfulInsert) {
    gotoPage("studentInsert.jsp",request, response);
    else {
    gotoPage("errorPage.jsp",request, response);
    private void gotoPage(String url,
    HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    RequestDispatcher dispatcher =
    getServletContext().getRequestDispatcher(url);
    dispatcher.forward(request,response);
    This is my useBean tag from the studentInsert.jsp:
    <jsp:useBean id="codin" class="edu.cod.CodInsert" scope="request" />

  • How to call backing bean method from java script

    Hi,
    I would like to know how to call backing bean method from java script.
    I am aware of serverListener and [AjaxAutoSuggest article|http://www.oracle.com/technology/products/jdev/tips/mills/AjaxAutoSuggest/AjaxAutoSuggest.html]
    but i am running in to some issues with [AjaxAutoSuggest article|http://www.oracle.com/technology/products/jdev/tips/mills/AjaxAutoSuggest/AjaxAutoSuggest.html]
    regarding which i asked for help in other thread with subject ....Question on AjaxAutoSuggest article (Ajax Transactions Using ADF and J...)
    The reason why i posted is ( though i realise both are duplicates) .. that threads looks as a specific question to that article hence i would like to ask the quantified problem is asked in this thread.
    So could any please letme know how to call backing bean method from java script
    Thanks
    Murali
    Edited by: mchepuri on Oct 24, 2009 6:17 PM
    Edited by: mchepuri on Oct 24, 2009 6:20 PM

    Hello,
    May know how to submit a button autoamtically on onload of page with clicking a welcome alert box. the submit button has managed button too to show a message on console using SOP.
    the problem is.
    1. before loading the page a javascript comes on which i clicked ok
    2. the page gets loaded and the button is there which gets automatically clicked and the managed bean associated with prints a message on console using SOP.
    I m trying to do this through server listener and click listener. the code is(adf jspx page)
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1" binding="#{backingBeanScope.backing_check4.d1}">
    <af:form id="f1" binding="#{backingBeanScope.backing_check4.f1}">
    <af:commandButton text="commandButton 1"
    binding="#{backingBeanScope.backing_check4.cb1}"
    id="cb1" action="#{beanCheck4.submit1}"/>
    <af:clientListener type="click" method="delRow"/>
    <af:serverListener type= "jsServerListener"
    method="#{backingBeanScope.backing_check4.submit1}"/>
    <f:facet name="metaContainer">
    <af:resource type ="javascript">
    x=confirm("hi");
    // if(x){
    delRow = function(event){
    AdfCustomEvent.queue(event.getSource(), "jsServerListener", {}, false);
    return true;
    </af:resource>
    </f:facet>
    </af:form>
    </af:document>
    </f:view>
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_check4-->
    </jsp:root>
    the backing bean code is -----
    public class classCheck4 {
    public classCheck4() {
    public String submit1() {
    System.out.println("hello");
    return null;
    }

  • How to chance default link style?

    I´m wondering how to chance different link states color and decoration? Now default is blue and underline. Ok. this can be done with embedded html / css, but there must be simple solution in Muse?

    You can edit the link styles , click on Hyperlinks > Edit link styles or edit from site properties :
    http://take.ms/CDpfZ
    Thanks,
    Sanjit

  • Accessing add() methods through bean properties ?!

    I hope this question is trivial...
    Is there a defined way of using add(*) methods through bean properties ?
    Seems a little odd that Swing components can't be added to a container in a simple "bean-like" way....is there a set*(*) method I've missed ? I'm aware of the getComponents() method on Container...but there's no setComponents(Component []) method.
    Thanks,
    Michael.

    Thank you for the repsonse....but..
    Wouldn't that mean that I'd have to sub-class all the Components I wanted to use....just to add the set*(*) method....isn't there a tidier way ?
    I really find this strange...(I can think of many examples where accessing the add*(*) methods through introspection (possibly by providing set*(*) methods) would be extremely useful....but, staying in a Swing context....)
    If you wanted to create an application that can load, edit and save GUI forms (as many already have). Having all Swing components stick to the javaBeans spec. is very useful. The application can use introspection to grab all the properties of a component, without having any hard-coded logic on dealing with specific classes. Users can then provide their own extensions to the components palette, and by sticking to the javaBeans convention, have the GUI editor expose those properties.
    But....to compose components together (a fundamental concept) the editor must be provided with "hard-coded" logic that knows how to deal specifically with Components (in that they have an add(*) method).
    This must also be a problem with the XMLDecoder class ?!
    When encoding a Swing component, the XMLEncoder can use all the get*() methods (including getComponents()) to persist the Container, its properties, and any sub-components....fine.
    But, when decoding this information, all the properties can be set through the usual bean mechanism (using the corresponding setPropertyName(*) method) except the sub-components....there is no setComponents(*) method.
    How does the XMLDecoder get around this problem ?
    Does it "know" that when it gets to the "components" property of a Swing component, it must call the add(*) method instead...?
    Thanks,
    Michael

  • How to get all property names and values of an bean instance at runtime?

    How can I get all property names and values of an bean instance at runtime?
    (The class of the bean instance is dynamic and I can not know before I write the code .)

    Look at Class. It has a way to get at all public methods and attributes.
    If you need to get to private attributes you can do what the Introspector does and expect the methods to follow the Bean pattern and pull the attributes out based upon that. Privates are all hidden from direct access but through the Bean Pattern they can be figured out.

  • How to use  ADF application functionality in Webcenter Portal

    Hi,
    We have an separate ADF application with bunch of functionality that are been using in others applications.We have to use these functionality in the WebCenter portal.
    In this ADF application, each jspx page used for implementing different functionality(for example Calendar for one page, subscriptions for one page like that) and there are no bounded task flow used.
    Challenge here is, need to some how import the ADF application as reusable component (section) and yet to use different functionality (I mean accessing each jspx page)
    So, what are the ways we can utilize these ADF functionality in WebCenter portal? Let me know your thoughts?
    Any help really appreciated.
    Thanks,
    San.

    All,
    if you have WebCenter in place the best way is to use the ADF portlet bridge. You can create portlet entries at design time in JDev on each JSPX as well as on any TaskFlow definition (right click as mentioned above). That's quite convenient if you stay in the WebCenter / ADF world. You'll get the standalone as well as the portletized application so the standalone version will still be working. Mind that if you portletize an ADF Application you need to deploy it in a portlet runtime. That means you need to extend your ADF container with the portlet runtime. That requires a WebCenter license for the server since the portlet runtime is a part of the WebCenter product stack.
    In respect of SSO, after deploying your Portlet Producer App you'll get WSRP Webservices on application level for which you can apply OWSM policies (Enterprise Manager) so the identity of the portal will be propagated to the Portlet Producer App. Details can be found on WebCenter Portal Developer's Guide.
    Just to let you know that these portlets can be only consumed on Oracle's portals (be that WebCenter or Oracle Portal 11g). That's caused by some Oracle specific WSRP additions to the ADFPortlet Bridge.
    Jiri, what do you mean with "enhance it with portal features"? Oracle's portlet aproach is fully based on WSRP, means decoupling. So you cannot add portal features to the portlet. Everything has to be packed in request and response. There's no direct access to portal /portlet resources to interact with.

  • How do I read a properties file in WEB-INF without hard-coding a path?

    Hello,
    How do I read a properties file in WEB-INF without hard-coding a path?
    I tried:
    Properties properties = new Properties();
    properties.load(new FileInputStream("db.properties"));
    driver = properties.getProperty("driver");
    but it cannot find the db.properties file.
    Thanks for the help.
    Frank

    Don't use a File to read those properties.
    Better to use the servlet context and
    getResourceAsStream() method to get the InputStream.
    It'll look for any file in the CLASSPATH. If you put
    that properties file in the WEB-INF/classes directory
    you'll have no problems, even if you deploy with a
    WAR file.Completely agree with this approach. Just have to mention the following for completeness
    according to the API,
    "This method is different from java.lang.Class.getResourceAsStream, which uses a class loader. This method allows servlet containers to make a resource available to a servlet from any location, without using a class loader. "
    So using this method, the resource can be anywhere under your web context, not just in the classpath.
    Cheers,
    evnafets

Maybe you are looking for