You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by acec acec <to...@yahoo.ca> on 2008/04/17 20:29:49 UTC

where is the best place of validation?

Hi,
After I read "Best Practices Guide", I still have a
question: "where is the best place of validation?"

I found "Another good example is doing special
pre-processing and validation on parameters before
passing them to a service for processing" in that
guide, so the validation should not be a part of
service, then I try to find an example, which has
validation logic.
But I found all validations were done in service, such
as: 
DhlServices.java, 
public static String sendDhlRequest(String xmlString)
{
...
 if (xmlString == null) {
            throw new DhlConnectException("XML message
cannot be null");
        }
...
}

Thanks a lot.
tomcat acec


      __________________________________________________________________
Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know at http://ca.answers.yahoo.com

return my parameters

Posted by acec acec <to...@yahoo.ca>.
Hi,
I have the following request mapping in my
controller.xml.
=================================================
<request-map uri="RemoveIt">
 <event type="service" path="" invoke="removeIt" />
 <response name="success" type="request-redirect"
value="ListIt"/>
 <response name="error" type="request-redirect"
value="ListIt"/>
</request-map>
=================================================
One of my freemarker file has a url link like:
<@o...@ofbizUrl>?id=11&view=10"

When I click that link, it will call removeIt() in my
service definition, then I want to pass the parameter:
view=10 to ListIt.
If I use type="request-redirect", it will pass all
parameters, but id=11 should be removed.
If I use request-redirect-noparam, it will not pass
parameters at all.

Is there a way to decide which parameter will be
passed?

Thanks.
tomcat acec



      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the new Yahoo! Canada Messenger for the Web BETA at http://ca.messenger.yahoo.com/webmessengerpromo.php

Re: where is the best place of validation?

Posted by BJ Freeman <bj...@free-man.net>.
I hope you get more responses than just mine.
Just as a note,
services as denoted in Best Practices Guide, mean those defined in the
servicedef and Scripts folders.
like the services_shipment_dhl.xml
the routine you show is not a service but a routine in the service java
class.
you have two types of Service code. Java and mini-language.
I believe, that the statement about validation was more directed to the
mini-laguage type of service.


acec acec sent the following on 4/17/2008 11:29 AM:
> Hi,
> After I read "Best Practices Guide", I still have a
> question: "where is the best place of validation?"
> 
> I found "Another good example is doing special
> pre-processing and validation on parameters before
> passing them to a service for processing" in that
> guide, so the validation should not be a part of
> service, then I try to find an example, which has
> validation logic.
> But I found all validations were done in service, such
> as: 
> DhlServices.java, 
> public static String sendDhlRequest(String xmlString)
> {
> ...
>  if (xmlString == null) {
>             throw new DhlConnectException("XML message
> cannot be null");
>         }
> ...
> }
> 
> Thanks a lot.
> tomcat acec
> 
> 
>       __________________________________________________________________
> Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know at http://ca.answers.yahoo.com
> 
> 
>