Create "Dynamic" beans to handle dynamic form

Hi All,
Hope it is not too stupid question.
JSP is all about dynamic content, a part of which can be a form that displays different fields and attributes. If I use Javabeans to handle the form, I will need different beans to go with each "configuration" of the form.
Now let's say I have a form that can get one of three "configurations" , depanding on the parameter passed to the JSP page.
I can create three Beans to match any type of form. (e.g., AFormBean, BFormaBean, CFromBean)
How can I conditionally instansiate the Bean to handle the not yet known type of the Form?
I tried to use an abstract Bean to be defined on the top of the JSP :
<%
Beans.AddComponentBean addComponentBean;
%>
    <c:choose>
        <c:when test='${param.type=="DBMS"}'>
                <jsp:useBean id="addComponentBean"            
                   class="Beans.AddDBMSBean" scope="page"/>
                <jsp:setProperty name="addDBMSBean" property="*"/>    
        </c:when> 
        <c:when test='${param.type=="APP"}'>
                <jsp:useBean id="addComponentBean"
                      class="Beans.AddAppBean" scope="page"/>       
                <jsp:setProperty name="addDBMSBean" property="*"/>    
        </c:when>                 
        </c:choose>
But that cannot be done since I get Use Bean duplicate.
What is the right way of doing this?
Thanks.

How I would do this depends on my application design.
I think I would go with a Factory type of design. I would have an 'AddBeanFactory' that decides on the specific type of the bean to create, and returns the abstract AddComponentBean. If you want to do it all in JSP, then making the factory a bean itself is usefull:
package beans;
import java.util.Map;
import java.util.HashMap;
public class AddBeanFactory {
     private String type;
     private Map parameters;
     private AddComponentBean addComponentBean;
     private static final Map<String, Class<? extends AddComponentBean>>TYPEMAP = new HashMap<String, Class<? extends AddComponentBean>>();
     static {
          TYPEMAP.put("DBMS", beans.AddDBMSBean.class);
          TYPEMAP.put("APP", beans.AddAppBean.class);
     public AddBeanFactory() {}
     public void setType(String type) { this.type = type; }
     public void setParameters(Map params) { this.parameters = params; }
     public AddComponentBean getAddComponentBean() throws InstantiationException, IllegalAccessException {
          if (addComponentBean == null) {
               if (type==null || parameters == null){
                    throw new IllegalStateException("The Component Type and Parameters must be set prior to retrieving the ComponentBean");
               addComponentBean = TYPEMAP.get(type).newInstance();
               //fill bean with parameters
          return addComponentBean;
}Then your JSP would be something like:
<jsp:useBean id="beanFactory" class="beans.AddBeanFactory" scope="page">
    <jsp.setProperty name="beanFactory" property="type"/>
    <jsp.setProperty name="beanFactory" property="parameters" value="${request.parameterMap}"/>
</jsp:useBean>
<c:set var="addComponentBean" value="${beanFactory.addComponentBean}"/>

Similar Messages

  • How to create dynamic forms

    Dear All,
    How is it possible to create a dynamic form controls in ADF?
    Well this is how my use case goes:
    A web service returns a schema that display the list of questions that user needs to supply.
    <questions>
         <question>
              <type>text<type>
              <data>What is your Name</data>
         </question>
         <question>
              <type>booleanOneChoice<type>
              <data>Gender</data>
              <list>
                   <value>M</value>
                   <value>F</value>
              </list>
         </question>
         <question>
              <type>choice<type>
              <data>Salary Range</data>
              <list>
                   <value>Less than 1000</value>
                   <value>Less than 10000</value>
                   <value>Greater than 10000</value>
              </list>
         </question>
    </questions>When this is rendered, I am should be able to see
    this sample pages in a form layout style.
    <af:inputText label="Label 1" id="it1"/>
    <af:selectOneRadio label="Label 1" id="sor1">
    </af:selectOneRadio>
    <af:selectOneChoice label="Label 1" id="soc1">
    </af:selectOneChoice>Sorry the question above is very trivial but I just wanted to simplify things?
    Has anyone done this use case before?

    Hi,
    I tried that code actually but you need some sort of an event before the components are shown.
    Say an event like when a button is click then you do some PPR.
    But my use case is like this, I need to create the component list from my managed bean
    before the page is shown to the user.
    Here's what I tried.
    I created a binding on my managed bean. Then I created a hidden output text
    and then I bind the value to a method of my managed bean.
    The purpose of the output text is so that I could call my managed bean method.
    <af:panelFormLayout id="pfl1"
        binding="#{pageFlowScope.myBean.dynamicForm}">
    </af:panelFormLayout>
    <af:outputText id="ot2" visible="false"
        value="#{pageFlowScope.myBean.generateRandomForm}"/>     My managed bean method is the one that populates the form
    public class MyBean{
          private RichPanelFormLayout dynaForm;
         public String generateRandomForm(){
              RichInputText text1 = new RichInputText();
              text1.setLabel("What is your name");
              dynaForm.getChildren().add(text1);
              AdfFacesContext ctx = AdfFacesContext.getCurrentInstance();
            ctx.addPartialTarget(this.getDynaForm());
              return null;
    }But, I notice that nothing is happening.
    What could be wrong in my approach?
    Thanks

  • How to creater dynamic form in Acrobat 9

    Can I make a form that will dynamically add pages (with header and footer) when needed in Adobe Acrobat 9 and if so where is the best documentation on how to do this?

    You can dynamically add pages using templates. This requires some relatively simple JavaScript programming. It will work in Acrobat (Pro or Standard) and Reader 11 (Win/mac), but not previous versions of Reader. Here are some links to the Acrobat javaScript reference:
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_Dev_Templates.80.1.html
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_Dev_Templates.80.2.html
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1216.html
    If you don't get a two-paned window with the navigation pane on the left, click "Show Navigation" icon in the upper-left.
    If it has to work with previous versions for Reader, Acrobat 9 Pro for Windows comes with the LiveCycle Designer application. With it you can create dynamic XFA forms that can work with Reader.

  • How to Create Dynamic form using table data

    Dear All,
    I have one Table called PRODUCT_MASTER where product details are stored. Say product A,B,C,D are stored in the table. Another table called SUB_PRODUCT_MASTER, which contains sub product details.Say A1,A1,B1,B2, B3,C1, C2, C3, D1,D2,D3.
    Now, I want to create a dynamic form based on product,sub product. for a whole month. For better under standing here is the format.
    PRODUCT A B C D
    SUB_PROD A1 A2 B1 B2 B3 C1 C2 C3 D1 D2 D3
    Days
    1 x x x x x x x x
    2
    3
    4
    5
    6
    7
    Now whenever I add one row in the PRODUCT)MASTER table and SUB_PRODUCT_MASTER table, Form should add one column in the form automatically. e.g. If I add Product E with two Sub product E1 and E2 then form should add ptoduct E column in the form with sub products E1 and E2 as per above format. Here days are fixed to 31. This forms should accept product wise daily despatch entry. For
    storing despatch entry another table is created.
    Please help to create this type od forms.

    You want I believe to create Croos-Table(Matrix) form. Visit Cross-table (matrix) forms layout and add "Please Send me too".

  • How I can create dynamically-formed requests or use native SQL in EJB?

    Hi all.
    I'm working around modify an example from NetWeaver Developer Studio (CarRental). I want to get ordered data from table and allow users to specify the ordering field, not in the code. EJB QL doesn't support dynamically-formed queries like "select object(b) from QuickBooking b where b.status like ?1 order by b.<b>?2</b>" so i can't passing field name as parameter into query. Creating a sorting method for every field is not good solution because I need a dynamically-formed requests.
    I think using native SQL will help but I don't know how I can use SQL in EJB.
    Thanks,
    Lev

    import javax.persistence.EntityManager;within class, place
    protected EntityManager  entityManager;of course make it public, private, whatever you need.
    Then, in your method
    entityManager.createNativeQuery(....);R. Grimes

  • Apps included with Creative Cloud for creating dynamic forms

    Do any of the creative cloud applications help you to write script for dynamic forms?

    Hi Steven,
    LiveCycle Designer comes bundled with Acrobat X Pro. It can be used for this purpose I believe. So you might want to hold off from upgrading to Acrobat XI. I'd recommend posting more details about what you are wanting to do here to confirm:
    http://forums.adobe.com/community/livecycle/livecycle_modules_and_development_tools/livecy cle_designer_es/livecycle_designer_es_faq
    -Dave

  • Creating dynamic form data with SetValue QPAC

    I'm creating form data in a workflow process, and using it to populate a dynamic XDP with a subform.  In my test form, the subform is named "Item", with a text field named "ItemData".  Initially, I can create the form field via the SetValue QPAC and using these parameters;
    location: /process_data/form/form-data/data/xdp/datasets/data/fields/Item/ItemData
    value: "first"
    However, I need to add multiple instances of the Item subform.  For example, if I fill out the test form with 3 items and export the data to XML, the data structure comes out like this:
    first
    second
    third
    So, the question is, how do I use the SetValue QPAC to create multiple instances of the items? I've tried various locations;
    /process_data/form/form-data/data/xdp/datasets/data/fields/Item.x/ItemData
    /process_data/form/form-data/data/xdp/datasets/data/fields/Item[x]/ItemData
    /process_data/form/form-data/data/xdp/datasets/data/fields/Item/ItemData.x
    but none of them seem to work.  I know I'm probably just missing something simple.  Anybody care to fill me in on the obvious?

    Hi Clifton
    Looking back on this thread, I think you're saying that the data is eventually going to come from a MySQL database.
    In that case, our SQLPlus QPAC will do the job perfectly.
    You just specify the query, specify the repeating element:
    /process_data/form/form-data/data/xdp/datasets/data/fields/Item
    and then map columns in the result set to sub-element of the Item.
    eg mycolumn -> ItemData
    The SQLPlus qpac will create all the repeating items for you.
    Does this work for you?
    If not, please specify what you'd like to see.
    A couple of options are:
    - A setValue qpac that correctly inserts for expressions like: process_data/form/form-data/data/xdp/datasets/data/fields/Item[2] (probably difficult to do)
    - An InsertSequence qpac that takes a repeating element and a count as an input, and creates that many repeating elements. You could then refer to them using the regular SetValue qpac. (Probably easier to do.)
    - Something else. Go wild :-)
    Howard

  • Create dynamic forms

    Hello,
    Hello I have an application based on JSF. We have a requirement to create forms dynamically, I mean end user should be able to add new controls to the form, without recompiling the application. Do u know some frameworks that do this ? For instance , I edit and xml file , and the application creates the form based on that. ? I was reviewing ORBEON framework, and I like the idea that with editing and xhtml file , I can make changed to the form and form submits XML information , but it seems to me complex or a long learning curve , besides it is a completely diferrent technology than JSF........do u know any similar idea like ORBEON , but implemented in JSF ? or how to integrate Orbeon and JSF ? . I want to keep the business logic in java code, and presentation in XFORMS
    Thanks,
    Deibys Quintero

    I'm in charge of the opensource project named XSLTForms (http://www.agencexml.com/xsltforms/).
    It's a client-side XForms solution based on XSLT to generate XHTML+Javascript.

  • Creating Dynamic Form based on table

    I have to create 7-8 Form on a Table with Report.
    Just wondering if there is a way, we can create this dynamically, so that I don't have to create this manually for each table.
    Exp - I will have a table list, once I will select table_name from the LOV, then this will display the Report/Form region for that table...and so on...
    thanks,
    deepak

    Hi Deepak,
    So, basically, you want to be able to create an application without actually having to create it manually?
    The nearest you could get, I think, is something like: Re: Creating Item dynamically and Automating tedious repetitive tasks / creating hundreds of different items (there may be other threads along these lines as well).
    The principle is that you do pretty much what an Application Export/Import would do. I have to stress, though, that this is totally unsupported by Oracle and also most forum users, myself included, would not be able to help you!
    Andy

  • ADOBE Forms (Creating Dynamic Forms)

    I am currently creating a form using Adobe Professional 8. IT is three pages each created on separate form files (.pdfx). I combine the files into a PDF package.
    I want to link up the pages together so that when the user types in a value on the first page that it also appears on another box on the second and third page.
    I also want it to be filled using Adobe Acrobat Reader and saved, then submitted.
    If you want me to send you the forms so you know what im talking about please let me know.
    Let me know if you have any questions, comments, or concerns.
    Thanks for all your help in advance!
    Chris P.

    Ensure the fields which are required to be filled on multiple pages have
    the same field name, use the distribute form option and you're done.
    Jon

  • Creating dynamic form fields

    I am trying to create a form with an input box, but also want to be able to have a link below it to be able to add another input box on demand. Does anyone know where i can find an example of this, i searched on google but wasn't able to find anything that good.

    I tried the following code in a .cfm page and everytime i run it i just get the following error:
    Server Error
    The server encountered an internal error and was unable to complete your request.
    Application server is busy.  Either there are too many concurrent requests or the server still is starting up.
    But any other page that run works fine, this is the only that gives me this error.
    <html>
    <head>
    <title></title>
    <script language="javascript">
    fields = 0;
    function addInput() {
    if (fields != 10) {
    document.getElementById('text').innerHTML += "<input type='file' value='' /><br />";
    fields += 1;
    } else {
    document.getElementById('text').innerHTML += "<br />Only 10 upload fields allowed.";
    document.form.add.disabled=true;
    </script>
    </head>
    <body>
    <cfform name="form">
    <input type="button" onclick="addInput()" name="add" value="Add input field" />
    <div id="text">
    </div>
    </cfform>
    </body>
    </html>

  • Create Dynamic Form Wizard

    I used this last week on several pages without any problems. Today, I created a new page and used this wizard and now I'm getting major errors.
    Here is what it's telling me. Looks like a Developer Toolbox breakdown?
    Error:
    Internal error.
    Developer Details:
    tNG_multiple.getFakeRecordset
    SQL error: Error creating temporary table:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'show TEXT, location TEXT, calendarID TEXT, kt_pk_calendar TEXT)' at line 1
    SQL:
    CREATE TEMPORARY TABLE KT_fakeRS_20080303 (month TEXT, date TEXT, year TEXT, show TEXT, location TEXT, calendarID TEXT, kt_pk_calendar TEXT). (MULTIPLE_FAKE_RS_ERROR)
    tNG Execution Trace - VIEW

    Hi Cheryl,
    Looks like a Developer Toolbox breakdown?
    no, it rather looks like you´re using so called "reserved words" in your column names :-) Indeed, "show" is one of them.
    For future reference here´s a list of all reserved words which you can´t use:
    http://www.htmlite.com/mysql002a.php
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Dynamic Form Creation in JSF

    Hi ,
    I wanted to know how to create dynamic form meaning in Database i have some rows and the user is provided the option to chose which all he wants to include... Only using the ticked ones i need to generate the form...
    Can anyone tel me hw to do dis

    Use the rendered attribute to conditionally show fields or not. It will be far less work than generating a dynamic form with a matching dynamic backing bean...

  • Tags in dynamic forms

    Has anybody create dynamic forms with tags?
    For me it is not possible to do this, only static forms can hold tags (Designer 8.o and 8.1 ES).
    So it is impossible to create accessible, dynamic PDF-Forms with Designer technology - is this the reality?
    regards
    Jan Hillmer

    Thanks Mike. I've been banging my head against the wall all day trying to figure out why my Livecycle Designer 8 forms aren't tagged. I couldn't find any info searching the Adobe site (I REALLY suck at google-like searches). Is there a known issues document that you can point us to that might have more info about current problems with tagging dynamic forms?

  • Dynamic Forms - Study Material

    Hi,
    We have to start working on dynamic forms. Currently I've started looking into the Help of Designer 7.0. But is there any good relevant study material for Creating dynamic forms.
    Thanks,
    -Jiya.

    There are a few tutorials and lessons that come with Designer Helps.
    You can go to Designer 'Help' menu and click on 'Getting Started'.
    You can also find the XML Form Object Model scripting guide from the link below. It provides detailed information about the different objects in each of those models, and their associated properties
    and methods.
    http://partners.adobe.com/public/developer/en/xml/Adobe_XML_Form_Object_Model_Reference.pd f
    Additional resources (tips and tricks...) can be found at http://partners.adobe.com/public/developer/livecycle/designer/devcenter.html
    Also, this user-to-user forum is also a very helpful source when it comes to issues or problems while you are designing your form.

  • Problem saving dynamic forms

    We created dynamic forms using LiveCycle. The users download them to their local PC and enter data. After they enter data they can initially save the form to their PC. However, after that initial save they have trouble saving the form. For some users they can save the same form five or six times before getting the error message for other users it can happen at the second attempt to save. We have set the form to have no security.
    The error message is the following:
    This document enabled extended features in Adobe Reader. The document has been changed since it was created and the use of extended features is no longer available. Please contact the author for the original version of this document.

    I discovered an answer to this problem, at least in my case...
    I posted my discovery in another forum topic here:
    David T Bartholomew, "Losing Reader Extension Rights After Saving" #31, 11 Dec 2008 3:45 pm

Maybe you are looking for

  • Is it too much to ask that a Mac user can just OPEN and USE a PDF form created by LiveCycle Designer PC software?!?

    My problem is just that- I have created all my forms using LiveCycle Designer because it is easier to make the forms accessible to individuals with disabilities.  Apparently it doesn't make Mac users have access to the forms.  I've received complaint

  • Too Many Activations HELP

    I have a Sony Reader and like most new devices, it tends to lock up occasionally so it needs to be reset, removing all information from it, including DE activations. I have been able to reauthorize till now with no problems. But today I am on number

  • DAQ collecting finite samples despite being set to continuous acquisition mode

    Hello, I've created a vi which reads data from one channel on my USB 6225 OEM device, displays the data to a chart, and writes the data to a .csv file using the write to spreadsheet file vi. The DAQ acquisition mode is set to Continuous Samples; howe

  • Having some troubles while playing Counter Strike: Source

    Hi guys, Currently I'm using the Macbook Pro 13.3" 2nd version ( 2.9GHz, etc.). It's from Mid 2012 I believe. Anyway, I got it for passing my finals, so I've got it for less than a month now. And the thing is, I'm not really satisfied with the way it

  • Get parent Account Details

    I want to create a new field on the account object. This new field should be automatically populated based on the parent account I choose. This functionality is similar to a pick map functionality in Siebel Enterprise. I understand that there is a fu