Announcement Announcement Module
Collapse
No announcement yet.
configuring multiple domain objects Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • configuring multiple domain objects

    hi guys

    I have this following scenario in my project:

    In my flow.xml i have
    <var name="baseDomain" class="com.domain.Basedomain"/>
    <view-state id="enterCriteria" view="abc\myjsp" model="baseDomain">
    <transition on="search" to="displaySearchResults" validate="true">
    <evaluate expression="BusinessAction.search" />
    </transition>
    </view-state>

    This is my BusinessAction.search method

    public final Event search(RequestContext context) throws MyException
    {
    try {

    Basodomain baseDomain = (Basodomain)context.getFlowScope().get("baseDomain ");
    BuisnessService sf = new BuisnessService();
    baseDomain = sf.searchForData(baseDomain);

    if(baseDomain.getType().trim().equalsIgnoreCase("C ")){
    Customer customer = (Customer)baseDomain;
    }
    else if(baseDomain.getType().trim().equalsIgnoreCase("S ")){
    Supplier supplier = (Supplier)baseDomain;
    }

    }

    }
    catch (Exception e) {
    e.printStackTrace();
    return error();
    }
    return success();
    }

    so from the above code in my flow xml i have <var name="baseDomain" class="com.domain.Basedomain"/>
    but in my BusinessAction.search() the baseDomain can either be of type 'Customer' or 'Supplier' because
    public class Customer extends Basedomain and
    Public class Supplier extends Basedomain
    and that is why i am casting Basedomain to Customer and Supplier

    All this is fine till here. I have the problem in my jsp because i want to display data from 'Customer' and Supplier' objects
    My jsp


    <form:form commandName="baseDomain" method="post"> --> THIS WORKS
    <form:input path="id" size="5" maxlength="4" />
    </form:form>

    <!-- This doesnt work because commandName is baseDomain, so how can i access customer object? -->
    <form:form commandName="customer" method="post">
    <form:input path="customerId" size="5" maxlength="4" />
    <form:input path="customerAddress" size="5" maxlength="4" />
    </form:form>

    <!-- This doesnt work again because commandName is baseDomain, so how can i access supplier object ? -->
    <form:form commandName="supplier" method="post">
    <form:input path="supplierId" size="7" maxlength="14" />
    <form:input path="supplierLocation" size="7" maxlength="14" />
    </form:form>

    Thanks very much for any kind of help.
    J
    Last edited by jaggernat; Dec 2nd, 2010, 10:28 PM.

  • #2
    hi guys
    any ideas how i can solve this? I want to use two or more domain objects in my jsp.

    thanks

    Comment

    Working...
    X