Thanks for your suggestion Christian.
I guess I was just being lazy by not looking at the code myself. :-) 
For posterity, the solution is as follows...

Just say you have a Thingy in a Wizard like this...

@Wizard
public SomeActionBean implements ActionBean {...@validatenestedproperties({ 
@Validate(field = "field1", required = true), @Validate(field = "field2", 
required = true), 
@Validate(field = "field3", required = true)
}) 
private Thingy thingy; 

@DefaultHandler
public Resolution something() {
return new ForwardResolution("/WEB-INF/jsp/somePage.jsp");
}

public void setThingy(Thingy thingy) {
this.thingy = thingy;
}

...
}

In your test you add delimited encrypted field names to the "__fp" param that 
you want field validation to fire for, like this...


String[] fields = new String[] {"thingy.field1", "thingy.field2", 
"thingy.field3"};
trip.setParameter("__fp", fieldGenerator.generate(fields));
trip.execute("something");

... and "fieldGenerator" looks like this...

import net.sourceforge.stripes.util.CryptoUtil;

public class DefaultHiddenFieldGenerator implements HiddenFieldGenerator {
    public String generate(String[] fields) {
        String result = concat(fields);
        return CryptoUtil.encrypt(result);
    }

    private String concat(String[] fields) {
        String result = "";
        for (String field : fields) result += "||" + field;
        result.replaceFirst("\\|\\|", "");
        return result;
    }
}

Just a quick moosh of code, but I hope you get the idea if you ever need to do 
this!

Kind Regards

Damien


      
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to