Not too difficult.
In your controller.xml and in the "findTransaction" request map, have 2 "success" responses, 1
named "success" and the other named "onlyOne". In the <event>, do your finding of transactions,
and redirect to the proper response path depending on whether there is only one transaction found
or not.
Jonathon
[EMAIL PROTECTED] wrote:
I have fooled with this all day now and I bet there is someone out there who
knows exactly how to do this.
I have a URL, showTransactions that is normally called like this:
.../showTransactions?billingAccountId=xyz
I have another url;
.../findTransactions
The user gets dispatched to .../findTransactions and enters a partyId is
present with a list of billingAccounts for a customer and they click on the
billing account and off they go they go to
.../showTransactions?billingAccountId=xyz
What I want to do is if there is only one billing account, I don't want them
to have to click the link. I want to take them right there. So, I tried
writing both a service and a servlet like this:
public static Map getBillingAccountCount(DispatchContext dctx, Map
context) {
and
public static String getBillingAccountCount(HttpServletRequest request,
HttpServletResponse response) {
In the first, I stuffed the billingAccountId in the context. In the second,
I stuffed it in an attribute (there is, unfortunately, no setParameter which
is exactly what I wanted).
Here is a sample of the dispatcher:
<request-map uri="findTransactions">
<security https="true" auth="true"/>
<!-- <event type="service" invoke="getBillingAccountCount"/> -->
<event type="java"
path="org.ofbiz.accounting.ar.BillingAccountWorker"
invoke="getBillingAccountCount"/>
<response name="fail" type="view" value="findTransactions"/>
<response name="success" type="view" value="showTransactions"/>
</request-map>
When the bash script gets called for showTransactions using either method,
billingAccountId is not there.
Anyone have any ideas on how to do this redirection and add parameters to
the request or context? I can do this with a servlet and filters, but I
don't understand how Ofbiz handles all that.
Skip