How to evaluate a bean property passed as attribute to a tag file?

I wrote the following tag file:
<%@ tag body-content="empty" %>
<%@ attribute name="domain" required="true" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<select>
     <jsp:useBean id="codeManagerBean" class="blabla.CodeManagerBean" />
     <c:set var="domainMethod">codeManagerBean.${domain}</c:set>
     <c:forEach var="code" items="${domainMethod}">
          <option value="${code.symbol}">${code.description}</option>
     </c:forEach>
</select> What I would like is to call a property of CodeManagerBean whose name was passed as an attribute.
Let's say this tag is used with the attribute domain="currencyCodes", the combo box should be filled with values from CodeManagerBean#getCurrencyCodes().
The problem is that, in order to define the value of items in the forEach instruction, I declared the variable domainMethod. Now I would like items to evaluate the method (and thus return an iterator in this case), and not a String (what it currently does...).
Any idea?
Colargol

Hi,
a managed property only gives you a anlde to a bean or property, it doesn't execute it. To execute a bean, you can use a custom JSF PhaseListener that calls a bean method. The reference to the bean is achieve through value binding
ValueBinding vb = FacesContect.getCurrentInstance().getApplication().createValueBinding("Name of Managed Bean);
TypeOfBean theBean =(TypeOfBean) vb.getValue(FacesContext.getCurrentInstance());
.... theBean.theMethod() ...
Frank

Similar Messages

  • Anyone know how to use a regex to find an attribute in a tag?

    Does anyone know how to do the following using a regular
    expression in dreamweaver?
    If cellpadding="ANYNUMBER" is located anywhere in a table
    tag, get rid of it? I can get it to work by searching for table
    cellpadding="([0-9]+)" but it only works if nothing is in between
    table and cellpadding. If it looks like table border="0"
    cellpadding="1", it won't work because border is in the way.

    Since 'cellpadding' can only be used in a table tag, just
    search for '
    cellpadding="([0-9]+)" and replace it with ''.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "jm1275" <[email protected]> wrote in
    message
    news:e5hl20$ge8$[email protected]..
    > Does anyone know how to do the following using a regular
    expression in
    > dreamweaver?
    >
    > If cellpadding="ANYNUMBER" is located anywhere in a
    table tag, get rid of
    > it?
    > I can get it to work by searching for table
    cellpadding="([0-9]+)" but it
    > only
    > works if nothing is in between table and cellpadding. If
    it looks like
    > table
    > border="0" cellpadding="1", it won't work because border
    is in the way.
    >

  • How do I get the bean property to JSP page for use in a Scriplet

    Hi all,
    I am new to JSF and would like to know how can I get the Bean property to a JSP page and then use that property to dynamically display the contents.
    Thank in advance,

    Hi,
    I think the following page will be helpfull.
    http://java.sun.com/developer/technicalArticles/javaserverpages/JSP20/
    Akif

  • How to set Bean property

    I have JSF input <h:inputtext> and JSF Button
    on click i want to set bean property value = user whatever enter in text box how acn i do that?

    well,
    You have to create backing bean with property setter and getter.
    Then:
    <h:inputtext value="#{beanName.propertyName}"/>Now when page is loaded getter is used and when submited setter goes in action
    I would recomend http://www.coreservlets.com/
    Message was edited by:
    m00dy

  • How to set bean property in jsf page

    Hi,
    Hopefully theres an easy solution, but I can't figure it out...
    I have a managed bean that spans several jsf pages.
    Within each page I want to set a flag that tells the bean which page it is serving (as well as some other params).
    How do I set a property of the bean in the page?
    I've tried
    <jsp:useBean id="filter3" scope="request" class="com.aol.rsistats.ui.FilterBean"/>
    <jsp:setProperty name="filter3" property="filterType" value="3"/>
    but that doesn't load the page through the normal JSF routine (and I initialise some values of the bean in the faces-config.xml file... so these are not initialiased when the setProperty is called) .
    (In general I get some strange behaviour when I mix jsf tags with jsp, or jstl, so I've avoided it as much as possilble)
    Is there another way?
    Cheers,
    Keith

    This example works for me (using jsf-1_1_01).
    Index.jsf:
    <%@ page contentType="text/html; charset=UTF-8" %>
    <%@ page language="java" %>
    <%-- jakarta-taglibs-standard-1.0 --%>
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <%--
    Note, that with jakarta-taglibs-standard-1.1.1 taglib directive
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    the example NOT works!!!
    --%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <html>
    <head>
    <title>MyTitle</title>
    </head>
    <body>
    <f:view>
    <%--
    Do not delete the following lines! You need to address to WIManager before using c:set.
    --%>
    <!--
    <h:outputText value="#{WIManager != null}"/>
    -->
    <c:set target="${requestScope.WIManager}" property="bpId" value="bpIdValue"/>
    <h:form id="MyWebFormTask" >
    <h:commandButton id="ok" action="ok" value="Ok"/>
    <h:inputHidden id="bpId" value="#{WIManager.bpId}"/>
    </h:form>
    </f:view>
    </body>
    </html>
    ok.jsf:
    <%@ page contentType="text/html; charset=UTF-8" %>
    <%@ page language="java" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <html>
    <head>
    <title>MyTitle</title>
    </head>
    <body>
    <f:view>
    WIManager.bpId: {<h:outputText value="#{WIManager.bpId}"/>}<br>
    </f:view>
    </body>
    </html>
    In ok.jsf I can see WIManager.bpId property set in Index.jsf.
    faces-config.xml:
    <managed-bean>
    <managed-bean-name>WIManager</managed-bean-name>
    <managed-bean-class>my.package.WIManagerBean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
    <property-name>bpId</property-name>
    <property-class>java.lang.String</property-class>
    <value>#{param.wim_bpid}</value>
    </managed-property>
    </managed-bean>
    Resume:
    -- use <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    instead of <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    -- address to WIManager before using c:set.

  • Problems setting managed bean property of type Integer

    I got a problem when I use valueBinding #{param.productId} in faces-config.xml for my managed bean:
    My property 'productId' in bean Product is of type Integer, and my bean is in request scope. When I try to invoke some action on page, wich should navigate me to another view - JSF is trying to set productId for current view, and of course it is empty (""), and for the reasons given above I'm getting an error:
    javax.faces.FacesException: Can't set managed bean property: 'applicationId'.
    at com.sun.faces.config.ManagedBeanFactory.setPropertiesIntoBean(ManagedBeanFactory.java:576)
    at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:233)
    at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:256)
    ... 60 more
    Caused by: java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:489)
    at java.lang.Integer.<init>(Integer.java:609)
    at com.sun.faces.config.ManagedBeanFactory.getConvertedValueConsideringPrimitives(ManagedBeanFactory.java:855)
    at com.sun.faces.config.ManagedBeanFactory.setPropertiesIntoBean(ManagedBeanFactory.java:555)
    Should I use requestScope instead of param to have my parameter null, and not "" ?
    If so, how should I pass requestScope parameter using commandLink?

    Hi! I have a problem with setting params too. Probably my one is different.
    I have a jsp page which show a datatable, where I can see a row for each Product. If I click on its name I would navigate to another page that shows product informations, as several ecommerce sites do.
    But I can't understand what and how I must set to inform the details page on which product have to show.
    I read in this forum that it's possible to set a parameter in productBean, and then the constructor of product bean loads others fields knowing its id.
    The snippet of my faces-config.xml is:
      <managed-bean>
        <managed-bean-name>product</managed-bean-name>
        <managed-bean-class>test.backing.ProductBean</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
        <managed-property>
          <property-name>idToLoad</property-name>
          <property-class>java.lang.Integer</property-class>
          <value>#{param.id}</value>
        </managed-property>
      </managed-bean>It is possible? is a correct solution? and if it is, how can I do that?
    Thanks very much if someone can resolve my problem.
    Claudio.

  • Including Bean-Property in Database-Binding

    Hello,
    I'm testing SJSC and right now I'm testing the Database-Bindings. I was successfull in integrating the MySQL JDBC-driver and creating JNDI-Ressource, JDBC-Ressource and Connection-Pool (I have several "RaveGenerated entrys but this problem will be solved later hopefully).
    My question is how I can integrate the value of a managed Bean in a SQL-Query of a Rowset. n my own Example I have a page where I enter a Short name in an Input-Field. This field is bound to a manged Bean and the name is a Property. I press a Okay-Button and on the next Page I display this Property again. This works finde. Now I will lookup in a database the long name corresponding to the short Name. I bound the Output-Field to a Rowset and the first long name is displayed from the database. I would like to display the long Name of the DB-Column of the entered short name. How can I do that?
    Best regards,
    Thomas

    Does your DbAccess bean have a "setJdbcUser" method?
    ie public void setJdbcUser(String user)Yes. Wouldn't the 'setProperty" tag cause compilation to fail if there was not a corresponding bean property?
    I'll add the standard disclaimer how db connections
    in JSPs is a bad idea. Such code should be in a servlet/bean.I have created context parameters in web.xml with the jdbc configuration values to create the connection. I created a context listener to open the connection on application initialization. My original conception was to create the connection in my controller servlet and then pass it as a request attribute and fetch it in the JSP. But, on further consideration, I could not find a way to do that without using a scriptlet. For that reason, I backtracked and created the DbAccess bean, whose purpose actually is to create the connection. So, the business with the jdbcUser property is really just me "feeling my way" with how these tags work in the JSP. I'm having difficulty in visualizing how to access that connection (or the data feed) in the JSP. I can create the DbAccess object with the JDBC connection in the listener.
    I am certainly open to suggestions as to the best way to make this work. I haven't found much guidance in the documentation I've read.
    Thanks for the reply.
    mp

  • How to get the 'text' property value of a button in coding?

    Hi Experts,
    I'm using 10 buttons all are having common action('click'). when i click a button the 'text' value of the button should pass to a function.So the action is same but the passed value will be the 'text' value of the corresponding button.  I don't know how to get the 'text' property of a button in coding. Kindly help me to solve this problem.
    Thanks and Regards
    Basheer

    Hi,
    My event is like this.
    public void onActionclick(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
         String s =  ?  ; // should get the 'text' property of clicked button
         fillInput(s);     // function to be called
    The called function is,
    public void fillInput( java.lang.String id )
        String str=wdContext.currentContextElement().getNum();
        str = str + id;
        wdContext.currentContextElement().setNum(str);
    How can i get the 'text' property value of the corresponding button. Click action should be common to all buttons.
    Thanks and Regards,
    Basheer

  • How to use Java Beans In JSTL?

    Hi
    I want to know how to use Java bean in JSTL
    please explain this with giving any one example.
    Thanks-
    Swapneel

    A bean is obtain by <jsp:useBean> tag nd once bean is obtained we can get its property by using getProperty tag.

  • Assigning bean property to custom tag's attribute

    1. The #{beanName.property} notation can only be used inside JSF tags.
    2. The attributes of custom tags does not accept embedded tags.
    e.g. <prefix:tagName attrib1="<jsftag>">
    I need to assign a bean's property to the attrib1 attribute. how do I do this?

    Alternatively, how can I assign the value of a bean property to a variable?
    e.g.
    <%
    int var=<bean.property>
    %>
    I can use the variable on the custom tag like this:
    <prefix:tagName attrib1="<%=var%>"> OR
    But this may not be the best solution though because I have to use scriptlets...

  • How to pass src value into img tag in ADF

    Hi,
    My Dev : 11.1.2.3.0
    How to pass row values into <img> tag.,I used the below code but it's taking empty.,
    I tried both ways like #{row.CdFilePath}   and   ${row.CdFilePath}
    <af:iterator var="row"
                      value="#{bindings.xxx.collectionModel}"
                     id="i2">
         <img src='/ShowImage?src=#{row.CdFilePath}' border='0' style="width:100px; height:100px; margin:5px;"/>
    </af:iterator>
    Please tell me any other option is there..
    Thanks

    This works if you use a normal table so I guess it should work here too.
    Are you sure the el #{row.CdFilePath} return something?
    Why don't you use the adf image tag <af:image source="/ShowImage?src=#{row.CdFilePath}".../> instead of the html img tag?
    Should the src property not be enclosed with " instead of your '?
    Timo

  • Comparing value of bean property/textbox in a form to a field in the db

    How do I compare the value of a bean property or the value of a textbox in a form (e.g. idno) to the value of an idno stored in my database using an SQL statement?
    I actually know that my SQL statement should resemble something similar to the one shown below:
    "SELECT * from user WHERE idno(value in the db) = idno(value entered in the form)"
    My problem is I am placing this SELECT statement on a .java file so I am clueless as to how I will state, using an SQL statement, that I only want to retrieve the record whose idno in the db matches the idno entered by the user in the form (whose value I store in a bean that is also inside the .java file I mentioned earlier).
    Should I place my SQL statement in the .java file or should I place it on my jsp instead?
    Any advice will greatly be appreciated! Thanks in advance!

    Hi
    Details:
    JSP - Contains a Form for entering ID number.
    Java Bean - Stores the ID number entered into the Form of the JSP page and also has the SQL Statement Object
    The Problem: Where should you put the SQL Statement Object ?
    Possible Solution: I think you are confused about SQL statements execution. This is what you can do. The Retrieved Id number from the Form has to be appended to the preformatted String which has the SQL statement stored in it. Once this is done this statement may be executed to retrieve the data associated with the ID number , if it exists.
    Here is a link that should help you build an SQL statement on the fly and execute it. Try out some of the examples.
    http://java.sun.com/docs/books/tutorial/jdbc/
    Good Luck!
    Eshwar Rao
    Developer Technical Support
    Sun mcirosystems inc
    http://www.sun.com/developers/support

  • Concurrency and javafx.beans.property

    I am building a MVC architecture and i'd like the model to be running independetly of the view/controller, so the model runs concurrently with the controller/view.
    the following example is a very simplified build on how i have it:
    controller:
    public class controller extends AnchorPane implements Initializable{
         private ObjectProperty<Model> m;
         @FXML Label aLabel;
         public controller() throws Exception{
              this.m = new SimpleObjectProperty<Model>(this, "Model", null);
              FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("../view/View.fxml"));
              fxmlLoader.setController(this);
              fxmlLoader.setRoot(this);
              fxmlLoader.load();
         @Override public void initialize(URL arg0, ResourceBundle arg1){}
         public void setGame(Model m) throws Exception{
              this.m.set(m);
              aLabel.textProperty().bind(this.m.get().getIntProperty().asString());
         public void start(){
              //Method1:
              m.get().start();
              //Method2:
              Task<Void> task = new Task<Void>() {
                   @Override public Void call() {
                        m.get().start();
                        return null;
              new Thread(task).start();
              //Method3:
              m.get().start();     //Model extends Thread and public void start() to protected void run()
              //Method4:
              m.get().start();     //Model extends Task<Void> and
                             //public void start() to protected Void call() throws Exception
              //Method5:          //calling any of the before ones on the controller that calls this one
    }model:
    public class Model extends Thread{
         IntegerProperty intProperty;
         public Model(){
              this.intProperty = new SimpleIntegerProperty(0);
         public IntegerProperty getIntProperty(){
              return intProperty;
         public void start(){
              while (true){
                   this.intProperty.set(this.intProperty.get()+1);
    }Tried any of those and the results are:
    -Method1: the view crashes and cannot be seen anything (model seems to be working since continues in the loop)
    -Method2: when reaches the first this.intProperty.set(this.intProperty.get()+1); the task gets frozen and stops
    -Method3: execution error on this.intProperty.set(this.intProperty.get()+1);
    -Method4: same as Method3
    -Method5: like before ones
    how can i make the it work?

    There are a few things wrong here.
    First, if you want the model to use a Thread, make sure you know how to use the Thread class. There's a decent section on concurrency at the [url http://docs.oracle.com/javase/tutorial/essential/concurrency/index.html]Java tutorial. What you need here is to have your Model class override the run() method, not the start() method. Then call the start() method, which will cause the run() method to be executed on a separate thread of execution. (You may be doing this in Method 3, I couldn't understand your comment.)
    This is probably just an artifact of your simplified version, but your run() method should block at some point. Multiple threads can be executed on the same processor, so your current implementation may hog that processor, making it impossible for the FX Application thread to do its stuff. For testing, throw in a Thread.sleep(...) call, wrapped in a try/catch block for the InterruptedException. I assume that the real application is waiting for something from the server, so there would be some "natural" blocking of the thread in that case.
    The important rule for the UI is that changes to the interface should only be performed on the FX Application thread. Assuming you have the implementation of your model correctly running on a background thread, you violate this with your binding. (The model sets its intProperty on the background thread; the binding causes the label's text to be changed on the same thread.) So to fix this your controller should listen for changes in the model's int property, and schedule a call to aLabel.setText(...) on the FX application thread using Platform.runLater(...). You want to make sure you don't flood the FX Application thread with too many such calls. Depending on how often the int property in the model is getting updated, you may need the techniques discussed in {thread:id=2507241}.
    The Task API from JavaFX provides nice mechanisms to call back to the JavaFX Application thread; however this is not really applicable in this case. The Task class encapsulates a one-off task that (optionally) returns a value and then completes, which is not what you're doing here.
    Here's a complete example; it's not broken out into separate FXML for the view and a controller, etc, but you can see the structure and break it down as you need.
    import javafx.application.Application;
    import javafx.application.Platform;
    import javafx.beans.property.IntegerProperty;
    import javafx.beans.property.SimpleIntegerProperty;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.Label;
    import javafx.scene.layout.AnchorPane;
    import javafx.stage.Stage;
    public class ConcurrentModel extends Application {
      @Override
      public void start(Stage primaryStage) {
        final AnchorPane root = new AnchorPane();
        final Label label = new Label();
        final Model model = new Model();
        model.intProperty.addListener(new ChangeListener<Number>() {
          @Override
          public void changed(final ObservableValue<? extends Number> observable,
              final Number oldValue, final Number newValue) {
            Platform.runLater(new Runnable() {
              @Override
              public void run() {
                label.setText(newValue.toString());
        final Button startButton = new Button("Start");
        startButton.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            model.start();
        AnchorPane.setTopAnchor(label, 10.0);
        AnchorPane.setLeftAnchor(label, 10.0);
        AnchorPane.setBottomAnchor(startButton, 10.0);
        AnchorPane.setLeftAnchor(startButton, 10.0);
        root.getChildren().addAll(label, startButton);
        Scene scene = new Scene(root, 100, 100);
        primaryStage.setScene(scene);
        primaryStage.show();
      public static void main(String[] args) {
        launch(args);
      public class Model extends Thread {
        private IntegerProperty intProperty;
        public Model() {
          intProperty = new SimpleIntegerProperty(this, "int", 0);
          setDaemon(true);
        public int getInt() {
          return intProperty.get();
        public IntegerProperty intProperty() {
          return intProperty;
        @Override
        public void run() {
          while (true) {
            intProperty.set(intProperty.get() + 1);
            try {
              Thread.sleep(50);
            } catch (InterruptedException exc) {
              exc.printStackTrace();
              break;
    }

  • How I can change visible property of an af:table with an af:selectOneRadio?

    How I can change visible property of an af:table with an af:selectOneRadio? Anyone can help me with a tutorial, example or link?
    Thanks in advance.

    After you add the required libraries to your classpath
    you can do your use case as explained in this sample
    page source
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
        <af:document title="untitled2.jsf" id="d1">
            <af:messages id="m1"/>
            <af:form id="f1">
                <af:selectOneRadio label="radio" id="sor1" autoSubmit="true"
                                   valueChangeListener="#{ControlVisibilty.onRadioSelected}">
                    <af:selectItem label="0" value="0" id="si1"/>
                    <af:selectItem label="1" value="1" id="si2"/>
                </af:selectOneRadio>
                <af:table value="#{bindings.DepartmentsView1.collectionModel}" var="row"
                          rows="#{bindings.DepartmentsView1.rangeSize}"
                          emptyText="#{bindings.DepartmentsView1.viewable ? 'No data to display.' : 'Access Denied.'}"
                          fetchSize="#{bindings.DepartmentsView1.rangeSize}" rowBandingInterval="0"
                          selectedRowKeys="#{bindings.DepartmentsView1.collectionModel.selectedRow}"
                          selectionListener="#{bindings.DepartmentsView1.collectionModel.makeCurrent}" rowSelection="single"
                          id="t1" partialTriggers="::sor1" visible="#{ControlVisibilty.table}">
                    <af:column sortProperty="#{bindings.DepartmentsView1.hints.DepartmentId.name}" sortable="false"
                               headerText="#{bindings.DepartmentsView1.hints.DepartmentId.label}" id="c1">
                        <af:inputText value="#{row.bindings.DepartmentId.inputValue}"
                                      label="#{bindings.DepartmentsView1.hints.DepartmentId.label}"
                                      required="#{bindings.DepartmentsView1.hints.DepartmentId.mandatory}"
                                      columns="#{bindings.DepartmentsView1.hints.DepartmentId.displayWidth}"
                                      maximumLength="#{bindings.DepartmentsView1.hints.DepartmentId.precision}"
                                      shortDesc="#{bindings.DepartmentsView1.hints.DepartmentId.tooltip}" id="it1">
                            <f:validator binding="#{row.bindings.DepartmentId.validator}"/>
                            <af:convertNumber groupingUsed="false"
                                              pattern="#{bindings.DepartmentsView1.hints.DepartmentId.format}"/>
                        </af:inputText>
                    </af:column>
                    <af:column sortProperty="#{bindings.DepartmentsView1.hints.DepartmentName.name}" sortable="false"
                               headerText="#{bindings.DepartmentsView1.hints.DepartmentName.label}" id="c2">
                        <af:inputText value="#{row.bindings.DepartmentName.inputValue}"
                                      label="#{bindings.DepartmentsView1.hints.DepartmentName.label}"
                                      required="#{bindings.DepartmentsView1.hints.DepartmentName.mandatory}"
                                      columns="#{bindings.DepartmentsView1.hints.DepartmentName.displayWidth}"
                                      maximumLength="#{bindings.DepartmentsView1.hints.DepartmentName.precision}"
                                      shortDesc="#{bindings.DepartmentsView1.hints.DepartmentName.tooltip}" id="it2">
                            <f:validator binding="#{row.bindings.DepartmentName.validator}"/>
                        </af:inputText>
                    </af:column>
                    <af:column sortProperty="#{bindings.DepartmentsView1.hints.ManagerId.name}" sortable="false"
                               headerText="#{bindings.DepartmentsView1.hints.ManagerId.label}" id="c3">
                        <af:inputText value="#{row.bindings.ManagerId.inputValue}"
                                      label="#{bindings.DepartmentsView1.hints.ManagerId.label}"
                                      required="#{bindings.DepartmentsView1.hints.ManagerId.mandatory}"
                                      columns="#{bindings.DepartmentsView1.hints.ManagerId.displayWidth}"
                                      maximumLength="#{bindings.DepartmentsView1.hints.ManagerId.precision}"
                                      shortDesc="#{bindings.DepartmentsView1.hints.ManagerId.tooltip}" id="it3">
                            <f:validator binding="#{row.bindings.ManagerId.validator}"/>
                            <af:convertNumber groupingUsed="false"
                                              pattern="#{bindings.DepartmentsView1.hints.ManagerId.format}"/>
                        </af:inputText>
                    </af:column>
                    <af:column sortProperty="#{bindings.DepartmentsView1.hints.LocationId.name}" sortable="false"
                               headerText="#{bindings.DepartmentsView1.hints.LocationId.label}" id="c4">
                        <af:inputText value="#{row.bindings.LocationId.inputValue}"
                                      label="#{bindings.DepartmentsView1.hints.LocationId.label}"
                                      required="#{bindings.DepartmentsView1.hints.LocationId.mandatory}"
                                      columns="#{bindings.DepartmentsView1.hints.LocationId.displayWidth}"
                                      maximumLength="#{bindings.DepartmentsView1.hints.LocationId.precision}"
                                      shortDesc="#{bindings.DepartmentsView1.hints.LocationId.tooltip}" id="it4">
                            <f:validator binding="#{row.bindings.LocationId.validator}"/>
                            <af:convertNumber groupingUsed="false"
                                              pattern="#{bindings.DepartmentsView1.hints.LocationId.format}"/>
                        </af:inputText>
                    </af:column>
                </af:table>
            </af:form>
        </af:document>
    </f:view>The managed bean code is
    import javax.faces.event.ValueChangeEvent;
    public class ControlVisibilty {
        private boolean table;
        public ControlVisibilty() {
            setTable(false);
        public void onRadioSelected(ValueChangeEvent valueChangeEvent) {
            // Add event code here...
            if(valueChangeEvent.getNewValue().toString().equals("1"))
                setTable(true);
            else
                setTable(false);
        public void setTable(boolean table) {
            this.table = table;
        public boolean isTable() {
            return table;
    }

  • How do I map custom property from portal api ptsearchresponse?

    I want to map the search results to my datatable.
    I can execute the search fine. But how do I map the property value? My property id is 101.
    In other words which ptSearchResponse method do I use?
                    IPTSession ptSession;
                    IPTSearchRequest ptSearchRequest;
                    IPTSearchResponse ptSearchResponse;
                    IPTSearchQuery ptSearchQuery;
                    string serverConfigDir = ConfigPathResolver.GetOpenConfigPath();
                    IOKContext configContext = OKConfigFactory.createInstance(serverConfigDir, "portal");
                    PortalObjectsFactory.Init(configContext);
                    ptSession = PortalObjectsFactory.CreateSession();
                    ptSession.Connect(1, "", null);
                    // Create a SearchRequest object
                    ptSearchRequest = ptSession.GetSearchRequest();
                    // Set search settings (constraints)
                    // Set maximum results desired (100)
                    ptSearchRequest.SetSettings(
                    PT_SEARCH_SETTING.PT_SEARCHSETTING_MAXRESULTS, 100);
                    // Set the folder in which to search (array to support multiple folders)
                    ptSearchRequest.SetSettings(
                        PT_SEARCH_SETTING.PT_SEARCHSETTING_DDFOLDERS,
                        new int[] { Convert.ToInt32(ConfigurationManager.AppSettings["DocumentFolderId"]) });
                    // Include subfolders of the folder
                    ptSearchRequest.SetSettings(
                        PT_SEARCH_SETTING.PT_SEARCHSETTING_INCLUDE_SUBFOLDERS, true);
                    // Restrict search to just portal documents
                    // (not ALI Collaboration or ALI Publisher)
                    ptSearchRequest.SetSettings(
                        PT_SEARCH_SETTING.PT_SEARCHSETTING_APPS, PT_SEARCH_APPS.PT_SEARCH_APPS_PORTAL);
                    // get documents only
                    ptSearchRequest.SetSettings(
                        PT_SEARCH_SETTING.PT_SEARCHSETTING_OBJTYPES, new int[] { PT_CLASSIDS.PT_CATALOGCARD_ID });
                    // Request the intrinsic PT_PROPERTY_PROVIDERCLSID and custom property 101
                    ptSearchRequest.SetSettings(
                        PT_SEARCH_SETTING.PT_SEARCHSETTING_RET_PROPS,
                        new int[] { PT_INTRINSICS.PT_PROPERTY_PROVIDERCLSID, 101 });
                    //Use IPTFilter to create search filter with clause with two statements
                    IPTFilter ptFilter;
                    IPTPropertyFilterClauses ptFilterClause;
                    IPTPropertyFilterStatement ptFilterStmt1;
                    IPTPropertyFilterStatement ptFilterStmt2;
                    // Create the filter itself
                    ptFilter = PortalObjectsFactory.CreateSearchFilter();
                    // Create the filter clause
                    ptFilterClause = (IPTPropertyFilterClauses)ptFilter.GetNewFilterItem(PT_FILTER_ITEM_TYPES.PT_FILTER_ITEM_CLAUSES);
                    ptFilterClause.SetOperator(PT_BOOLOPS.PT_BOOLOP_OR);
                    // Attach it to the filter itself
                    ptFilter.SetPropertyFilter(ptFilterClause);
                    // Put two statements into the clause
                    ptFilterStmt1 = (IPTPropertyFilterStatement)
                        ptFilter.GetNewFilterItem(PT_FILTER_ITEM_TYPES.PT_FILTER_ITEM_STATEMENT);
                    ptFilterStmt1.SetOperand(101);
                    ptFilterStmt1.SetOperator(PT_FILTEROPS.PT_FILTEROP_CONTAINS);
                    ptFilterStmt1.SetValue(tbSearch.Text.Trim());
                    ptFilterClause.AddItem(ptFilterStmt1, ptFilterClause.GetCount());
                    ptFilterStmt2 = (IPTPropertyFilterStatement)
                        ptFilter.GetNewFilterItem(PT_FILTER_ITEM_TYPES.PT_FILTER_ITEM_STATEMENT);
                    ptFilterStmt2.SetOperand(1);
                    ptFilterStmt2.SetOperator(PT_FILTEROPS.PT_FILTEROP_CONTAINS);
                    ptFilterStmt2.SetValue(tbSearch.Text.Trim());
                    ptFilterClause.AddItem(ptFilterStmt2, ptFilterClause.GetCount());
                    // Make the filter into an actual search query
                    ptSearchQuery = ptSearchRequest.CreateAdvancedQuery(ptFilter);
                    // Run the search and return results
                    ptSearchResponse = ptSearchRequest.Search(ptSearchQuery);               
                    // How many things matched the search?
                    int totalMatches = ptSearchResponse.GetTotalMatches();
                    // How many items were returned? (Not necessarily all)
                    int returnedMatches = ptSearchResponse.GetResultsReturned();
                    // create DataTable and map results to
                    // datatable fields
                    DataTable dtSearchResults = new DataTable("Documents");
                    dtSearchResults.Columns.Add("Name");
                    dtSearchResults.Columns.Add("Excerpt");
                    dtSearchResults.Columns.Add("DocSubject");
                    dtSearchResults.Columns.Add("DocTopic");
                    dtSearchResults.Columns.Add("DocType");
                    dtSearchResults.Columns.Add("DocKeywords");
                    dtSearchResults.Columns.Add("Url");
                    dtSearchResults.Columns.Add("ImageURL");
                    DataRow dr;                                                                                                          
                    // Print the name of each result
                    for (int i = 0; i < returnedMatches; i++)
                        dr = dtSearchResults.NewRow();
                        String strName = ptSearchResponse.GetFieldsAsString(i, PT_INTRINSICS.PT_PROPERTY_OBJECTNAME);                  
                        String strText = ptSearchResponse.GetFieldsAsString(i, PT_INTRINSICS.PT_PROPERTY_OBJECTSUMMARY);
                        String strURL = ptSearchResponse.GetFieldsAsString(i, PT_INTRINSICS.PT_PROPERTY_DOCUMENTURL);
                        String strImageURL = ptSearchResponse.GetFieldsAsString(i, PT_INTRINSICS.PT_PROPERTY_OBJECTIMAGEUUID);
                        dr["Name"] = strName;
                        dr["Excerpt"] = strText;
                        dr["Url"] = strURL;
                        dr["ImageURL"] = "pt://images/plumtree/portal/public/img/sml" + strImageURL + ".gif";
                        dtSearchResults.Rows.Add(dr);
    Edited by [email protected] at 04/11/2008 7:26 PM
    Edited by [email protected] at 04/11/2008 7:27 PM

    Problem solved. I should use JsonObject instead of JSONObject :D 

Maybe you are looking for

  • Using an essbase substitution variable in dataexport command in a BR

    Hi, I have created a calc script to export data using DATAEXPORT, and to define the filename an essbase variable. Here all right I copy this code to a business rules to run it from a business rules, but I have a problem with the essbase variable, whe

  • Adding a field to an sql statement in Oracle Reports error ORA-00933

    We have been requested to add a field that already exists in the table referred to by the sql statement in Oracle Reports Builder. The report was set up by a consultant about 3 yrs ago and we don't really have much skill in this area. What is happeni

  • Pressing Enter inserts new line break instead of "executing" command

    I have noticed a rather strange behavior on my new TPT2. This occurs ONLY when I am using the Windows 8 touch keyboard in the "Metro" environment. Whenever I press the Enter key on said keyboard (for example when sending an instant message on Skype),

  • Set .jpg as read only OK?

    Whilst I shoot raw with my SLR's, the 'toy' compact only shoots jpgs I'm fed up with them changing all the time when I add key wordwords, develops, etc.  Sadly, LR can't create XMP's, so I'm thinking of making all my jpg's Read Only. Obviously this w

  • Any Idea Which Message type/Idoc Type should be used for FI Invoice

    Hi Experts, Any idea what message type/Idoc type should be used for FI invoice. We are going to send IDOC from R/3 to Non-SAP System using ALE. We are using T-codes FV60/FV65. Thanks, Sony