JSF 2.0 and 'Target Unreachable' with nested bean properties

Hi people,
I know that JSF 1.x were not able to created objects for intermediate properties and that it was necessary to create 'y' in 'x.y.z' when 'x' was a managed bean and you wanted to create a new 'y' and set it's 'z'.
My question is: does JSF 2.0 somehow fix this? I'm coming from the Stripes world where this is all done automagically and it's a pretty addictive thing. I'm evaluating JSF and this is so far the first major drawback I see -- in case it can't be done.
If this isn't possible, what is the best practice for creating the object? @PostConstruct on the managed bean? if (y == null) ... in getY() ?

You could define an instance Y in the same scope as 'x' and then inject it into 'x' as a managed property. This is probably dead simple using annotations. It wouldn't be hard with the XML either, just verbose.
If you really want it to be magical, you could create an implementation of javax.el.ELResolver that creates intermediate properties when you need them. Perhaps one already exists; perhaps the Stripes code has one.

Similar Messages

  • Dependency Injection and Target Unreachable returned null

    Hello
    I have tried a simple code in jsf 2.
    This is it
    following is jsp
    <h:form>
    <h:inputText value="#{MBTest.thePerson.name}"/>
    <h:commandButton value="submit" action="#{MBTest.action}"/>
    <h:messages/>
    </h:form>
    following is Managed bean MBTest
    @ManagedBean(name="MBTest")
    @RequestScoped
    public class MBTest {
    @ManagedProperty (value="#{thePerson}")
    private Person thePerson = null;
    public MBTest() {
    public Person getThePerson() {
    return thePerson;
    public void setThePerson(Person thePerson) {
    this.thePerson = thePerson;
    public void action() {
    System.out.println(thePerson.getName());
    following is Person class
    public class Person {
    private String name = null;
    private int age = 0;
    public int getAge() {
    return age;
    public void setAge(int age) {
    this.age = age;
    public String getName() {
    return name;
    public void setName(String name) {
    this.name = name;
    But once this executed the page displays (please note that 'thePerson' instance of managed bean is not instantiated, just the managed property has been declared). When the button is pressed it gives me the followuing error
    /index.xhtml @12,60 value="#{MBTest.thePerson.name}": Target Unreachable, 'thePerson' returned null
    Could you please tell me why?
    Off the topic :
    Where is the code tags? I can't find it here.

    as far as I can see, your Person class is not a managed bean. I would expect an annotation @ManagedBean(name="thePerson") on it. If you don't make it a managed bean, JSF does not know it exists.
    If you don't want person to be a managed bean, then simply create an instance yourself in your MBTest class.
    private Person thePerson = new Person();

  • Save and submit issues with nested/expanding form

    I've built two forms in designer (Form_B and Form_C, we'll say) which use scripted repeating subforms to accomodate a range of inputs without presenting the user with piles of fields. I need both of them to correctly maintain their state when saved and re-opened, and transmit the data I need through acrobat.com distribution.
    Form B currently doesn't save and re-open correctly:
         There are two levels of repetition, Areas and Categories. There can be one or more Areas, and each Area has one or more Categories. If I open the form (in Acrobat Pro) and fill it out with 2 areas, each area having 2 categories, when i save and re-open the file the second Area is gone, and the first Area has 4 categories.
    Form C has many fields (up to 1500+) but I only need a fraction of them to be submited
         On the assumption that the settings in the "binding" pallet would controll this for me, I made a script to unbind all the unnnessisary fields pre-submit, and reverse the changes post-submit. When I test this, the fields still save and submit despite being set fieldName.bind.match = "none". I would also like to temporarily re-name the submitted fields so they come through with unique names. I have a script to do this, and I tested it by running the script (confirming that they changed by looking at the mouse-over tooltip) and saving the form in that state. The form will open back up with the old(unchanged) names and those fields have lost other layout settings.
    On both forms, all fields and subforms are normally set to binding = "normal", or fieldName.bind.match = "once"
    I currently have no external data bindings (the data view pallet is blank.)
    Any thoughts on why fields whos binding = "none" would still submit/save?
    Or why repeating subforms with binding = "normal" would get lost in a save?
    Is originalFieldName.name = "newName" somehow not sufficient to change how that fieldname gets saved in the data? (despite the apparent name change)
    I've searched all the resources I know for any useful idea on this one, and came up blank. Any help or suggestions would be much appreciated.
    <<<<<   don't rule out "It shouldn't do that, it must be buggy."  I'm starting to lean that way pretty heavily on a couple counts.  >>>>>>
    If anyone would like to see the files in question,  please send me an email at  manager<at>rocklight<dot>net and I'll get a copy of each off to you first thing in the morning.

    I've found a partial answer for the Form_B issue. (areas and categories not saving correctly):
    It looks like another case of this - http://forums.adobe.com/message/1358727#340913
    but for subforms.
    In order to keep my naming consistent, I had every repeating subform at every level called "fields" and within that a subform called "content" etc. (See attached image) It looks like when the file is re-opened, acrobat/reader is finding the First node named "fields" to apply the saved information to, rather than the correct one. When i renamed the subforms to "AreaFields" and "CatFields" it seems to have solved the problem. (It's still giveing me extra categories, but i think more re-naming is going to solve that too.
    Still looking for a solution to the submission problem: how to only submit some of the fields in a form.
    (yeah, the nesting is rediculous, I know, but it was necisary for some formatting elements.)

  • Re creating Express Analyzer and Express Basic with BI Beans

    I am trying to move an application from Express Family to Oracle OLAP 9i. I wanted to know how practically Express 4GL codes can be moved to OLAP DML and Express Analyzer/Express Basic be re-developed using BI Beans.
    I am completely unaware of the method of doing it but have experience in Oracle DB 8i/9i for 4 yrs and OLAP activities for 1.5 yrs. So can understand the technical answering.
    Kindly contribute to my query very very urgently.

    Hi,
    Firstly, you can do some What-if type analysis with Discoverer. You can use a temporary table so that data stored by the user will only be available to the current session. I have used this technique successfully, but you don't get the power and flexibility of Express Analyzer.
    You can look at using BI Beans with JDeveloper. It's quite straightforward but you will need a different skill set.
    You could also have a look at Oracle BI Enterprise Edition (aka Siebel Analytics). Another option is to use Oracle Applications Express which is a fast and simple applications development environment.
    Hope that helps,
    Rod West

  • Report for production order with actual and target cost for each

    Hi
    Is there any report that gives me the list of all production orders in a month with its respective actual and target costs?
    I can use COOIS to get a list of production orders, then double click on the prod order, then click on goto and then to cost analyis.. but can i avoid going through all this and get a report with the details i need?
    thanks in advance

    Thanks a lot for that.
    I'm a little confused with the columns in the report.
    Which columns should I keep for my requirement? -
    Production Order
    Total Target Cost
    Total Actual Cost
    Total Actual Qty
    Total Target Qty
    Thanks

  • JSF datatable - any difference with JSF 1.1 and JSF 1.2

    Hi All,
    In my project there are lot of Datatables, which retrieve data from the database and display it to the user. For each datatable, the columns are not fixed. I want to create some kind of component that can be reusable.
    It is basically a JSF portlet. Now i have to use RAD 6. RAD 6 supports only JSF1.1. I have to migrate this to RAD7 in the near future. Are there any differences between the Datatable in JSF 1.1 and JSF 1.2?
    I had this approach in mind.
    a) Create the datatable programmatically and put the contents to panelgrid. This way the jsp code will be minimized. Is it a good option.? Are the APIs same in both the versions?
    b) Is it possible to create a custom datatable which can take some key as input. Then based on the key the datatable can be populated with as many columns as desired.
    Please let me know if there are any other good options.
    ~Anitha.

    Hi guys,
    my code goes like this..
    for (int j = 0; j < size; j++) {
                   UIColumn column = new UIColumn();
                   dataTable.getChildren().add(column);
                   HtmlOutputText header = new HtmlOutputText();
                   header.setValue(periodHeader[j]);
                   column.setHeader(header);
                   HtmlOutputText output = new HtmlOutputText();
                   output.setValue(new Double(periodLiability[j]));
                   ValueBinding vb1 = FacesContext.getCurrentInstance()
                             .getApplication().createValueBinding(
                                       ("#{liability.periodLiability["+j+"]}"));
                   output.setValueBinding("value", vb1);
                   column.getChildren().add(output);
    this code gives me the number of headers i need. But, it doesnt render the columns. I have an array of Double (periodLiability) which stores few values of Double type. I want to show thesee values inthe dataTable Column.
    Please help me..

  • Jdev 10.1.3 and JSF  "comandlink component" don't work with Data filter

    I´m working in JSF with Jdeveloper 10.1.3 and Oc4j .
    I have a problem.
    I have .jspx where display employees of the company.
    The field employeeid have "comandlink component" with action "control.editemployee"
    when I fetch all data comandlink work OK.
    But I filter data by field, example Employee name Command link not work
    Help me, please.

    thanks
    i'm a little bit confused by the fact that jsf in 10.1.3 preview use managed bean (instead of data control) to get/put data from the model layer.
    we are using entity bean and session facade. In 9.0.5.2 we are using dto and data control to generate our jsp.
    we are currently testing/discovering jsf and search the best way to efficiently generate our ui's
    what is right way for jsf
    a) managed bean (if it is possible with session bean)
    b) data control when/if available
    and why ?

  • I HAVE A SOURCE TABLE WITH 10 RECORDS AND TARGET TABLE 15 RECORDS. MY WUESTION IS USING WITH THE TABLE COMPARISON TRANSFORM I WANT TO DELETE UNMATCHED RECORDS FROM THE TARGET TABLE ??

    I HAVE A SOURCE TABLE WITH 10 RECORDS AND TARGET TABLE 15 RECORDS. MY QUESTION IS USING WITH THE TABLE COMPARISON TRANSFORM .I WANT TO DELETE UNMATCHED RECORDS FROM THE TARGET TABLE ?? HOW IT IS ??

    Hi Kishore,
    First identify deleted records by selecting "Detect deleted rows from comparison table" feature in Table Comparison
    Then Use Map Operation with Input row type as "delete" and output row type as "delete" to delete records from target table.

  • Very big problem with JSF about FORM and "id=" for HTML form's elements and

    I have discovered a very big problem with JSF about FORM and "id=" for HTML form's elements and java instruction "request.getParameterNames()".
    Suppose you have something like this, to render some datas form a Java Beans :
    <h:dataTable value="#{TablesDb2Bean.myDataDb2ListSelection}" var="current" border="2" width="50%" cellpadding="2" cellspacing="2" style="text-align: center">
    <h:column>
    <f:facet name="header">
    <h:outputText value="Name"/>
    </f:facet>
    <h:outputText id="nameTableDb2" value="#{current.db2_name_table}"/>
    </h:column>
    </h:dataTable>
    Everything works fine...
    Suppose you want to get the name/value pairs for id="nameTableDb2" and #{current.db2_name_table} to process them in a servlet. Here is the HTML generated :
    <td><span <span class="attribute-name">id=<span class="attribute-value">"j_id_jsp_1715189495_22:0:nameTableDb2">my-table-db2-xxxxx</span></td>
    You think you can use the java instructions :
    Enumeration NamesParam = request.getParameterNames();
    while (NomsParam.hasMoreElements()) {
    String NameParam = (String) NamesParam.nextElement();
    out.println("<h4>"++NameParam+ "+</h4>);
    YOU ARE WRONG : request.getParameterNames() wants the syntax *name="nameTableDb2" but JSF must use id="nameTableDb2" for "<h:outputText"... So, you can't process datas in a FORM generated with JSF in a Servlet ! Perhaps I have made an error, but really, I wonder which ?
    Edited by: ungars on Jul 18, 2010 12:43 AM
    Edited by: ungars on Jul 18, 2010 12:45 AM

    While I certainly appreciate ejb's helpful responses, this thread shows up a difference in perspective between how I read the forum and how others do. Author ejb is correct in advising you to stay inside JSF for form processing if form processing is what you want to do.
    However, I detect another aspect to this post which reminds me of something Marc Andreesen once said when he was trying to get Netscape off the ground: "there's no such thing as bad HTML."
    In this case, I interpret ungar's request as a new feature request. Can I phrase it like this?
    "Wouldn't it be nice if I could render my nice form with JSF but, in certain cases, when I REALLY know what I'm doing" just post out to a separate servlet? I know that in this case I'll be missing out on all the nice validation, conversion, l10n, i18n, ajax, portlet and other features provided by JSF".
    If this is the case, because it really misses the point of JSF, we don't allow it, but we do have an issue filed for it
    https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=127
    If you can't wait for it to be fixed, you could decorate the FormRenderer to fix what you want.
    I have an example in my JSF book that shows how to do this decoration. http://bit.ly/edburnsjsf2
    Ed

  • I am in the process of developing a site, and I'm working with nested iframes. The html page inside the nested iframe is not displying in the iframe window in Firefox only, but is instead opening in a new window. Any advice on how to fix this?

    I am developing a website with nested iframes. The problem that I am having is that the html page inside the nested iframe is not displaying in the iframe window in Firefox only. The first level iframe is behaving properly, but the second level is not. Any help with this would be greatly appreciated.

    Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox. <br />
    http://forums.mozillazine.org/viewforum.php?f=25 <br />
    You'll need to register and login to be able to post in that forum.

  • Using generics and J2SE together with JSF

    Hi
    Has anybody experience with using JSF together with J2SE 1.5? Especially generics? I would like to use generics and other improvements from J2SE in the model objects.
    Thnaks in advance ... Rick

    JSF 1.1 is specified for J2SE 5, and the new specification (JSF 1.2 and JSP 2.1) does not include generics.
    If you are talking in terms of ValueBindings or MethodBindings, there really isn't any point since the implementation could only make the cast for you; and it would still not be able to garuantee type safety (the only reason to use generics).
    That's not to say you couldn't use generics in your own development, but I don't think you will see generics incorporated into the specification any time soon.
    Jacob Hookom (JSR-252 EG)

  • Target group with attributes of persons and organizations

    Hi,
    we are using marketing attributes for persons and organizations.
    Now, we want to realize a segmentation for organizations with marketing attribute “productgroup xyz” and persons with marketing attribute ”decider”.
    Is it possible to combine organizations with marketing attributes and persons with marketing-attributes in one target group?
    thanks

    Hi,
    thank you very much for your answers!
    I’m sorry, I think my description was too short. I have the following situation /  problem:
    I am using InfoSet CRM_MKTTG_BP_ORG with business partner BUT000-PARTNER_GUID.
    My person datasource based on Info Set CRM_MKTTG_BP_ORG and business partner BUT000_PER-PARTNER_GUID.
    Furthermore I’m using an attribute Set for organizational attributes and an attribute set for person attributes.
    Now I want to build up a target group with persons who have specific attributes. The persons should be members of organisations with specific attributes.
    Example:  Persons with attribute “decider” should be member of organizations with attribute “productgroup xyz”.
    We are using SAP CRM 5.0. I added the function modul CRM_MKTTG_PF_BP_TAB_TO_CP in my organization Datasource. 
    But I have problems to build up a profil set and a target group where I can combine the attributes of the organizations and the attributes of the persons. The counting result is ‘0’.
    I hope my description is understandable. Thank you in advance!
    Volker

  • Target group with customer and contact person

    Hi experts,
    I want to create a target group with customer data and the names of the main contact person to execute a campaign.
    During execution I need the name of the contact person to personalize my forms, the campaign activity should be connected to the customer (and not the contact person).
    Is there a functionality to solve my problem? (CRM 7.0)
    Thanks in advance.
    Werner

    Hi Werner,.
    I assume you want to select for Organizations (BUT000 Type 2) and you want to see in the Target Group the Contact Persons which are assigned via Relationship to the Orgnizations.
    Create for example a Datasource with  Infoset CRM_MKTTG_BP_ORG, and under Details for Business Partner use BUT000_PER-PARTNER_GUID.
    In Field Function Module maintain CRM_MKTTG_PF_BP_TAB_TO_CP.
    Create an Attribute List an assign the Datasource. After Creating the Target Group you will see the Organizations with all the assigned Contact Persons via Relationsship.
    Regards
    Andreas
    Another Tip: Create a Target Group for Persons, assign it to the Campaign, and now set the B2B Flag. Depending from your SP Level you have to apply a note so that the B2B Flag is visible (1263915)
    If you set the B2B flag you will get Communication Data for letters, for a Call List from the Relationship.
    Regards,
    Andreas
    Edited by: Andreas Pauli on Apr 29, 2009 10:18 AM

  • CAST and MULTISET with nested table

    I am trying to figure out the syntax of using
    MULTISET. I have two queries.
    One very basic where I want to cast the station names
    and ids, retrieved from a regular table into a nested
    table.
    e.g.
    SELECT cast(multiset(stn_id, stn_name) as castTab) FROM station_tab WHERE stn_name like '%xyz%';
    The other retrieve sections of a nested table and cast back as
    nested table type.
    SELECT * FROM CAST(MULTISET(SELECT * FROM
    THE (SELECT tmn_history FROM tmin WHERE tmn_stn_ncdcid = 01063456) NT
    WHERE (EXTRACT(YEAR FROM NT.dta_date) = 1915) AS data_tab ;
    The schema/tables are as follows
    =========================================================================
    CREATE TABLE station_tab
         stn_id     INTEGER PRIMARY KEY,
         stn_name VARCHAR(50)
    CREATE OR REPLACE TYPE data_point AS OBJECT
         dta_date      DATE,
         dta_val NUMBER,
         dta_dtobtnd DATE
    CREATE OR REPLACE TYPE data_tab AS TABLE OF data_point;
    CREATE TABLE tmin
    tmn_stn_id     INTEGER ,
    tmn_history data_tab
    ) NESTED TABLE tmn_history STORE AS tmn_history_tab;
    CREATE OR REPLACE TYPE castObj AS OBJECT
         dta_val NUMBER,
         stn_name VARCHAR(50)
    CREATE OR REPLACE TYPE castTab AS TABLE OF castObj;
    =====================================================================
    Thank you.
    barr

    With trial and error and going thru the examples
    in AskTom and documentation found that the follwing syntax works.
    (Also realized this is the wrong forum);
    SELECT * FROM TABLE (cast(multiset
    (SELECT stn_ncdcid,stn_name FROM station_tab WHERE stn_name LIKE '%WSFO%')
    AS castTab));
    select * FROM TABLE (CAST(MULTISET (SELECT * FROM
    THE (SELECT tmn_history FROM tmin WHERE tmn_stn_ncdcid = 01063456) NT
    WHERE (EXTRACT(YEAR FROM NT.dta_date) = 1915)
    ORDER BY NT.dta_date) as data_tab)) ;

  • One problem with constraints missing in source and target database....

    DB Gurus,
    In my database I am going to export and import data using datapump but dont specify CONTENT clause.
    so when I start working on my application, I came to know there are some constraints are missing. now how to check what are the constraints are missing from Source database and how to create those missing constraints on Target database?
    Suggest me if you have any idea.

    Create a database link between source and target schema.
    Use all_/dba_/_user_constraints to generate the difference using MINUS operator.
    something like this:
    select owner,constraint_name,constraint_type from dba_constraints@source
    MINUS
    select owner,constraint_name,constraint_type from dba_constraints

Maybe you are looking for