Hi Garth,
Garth Dahlstrom wrote:
I'm new to click, I have some questions as I get into it....
1) Is there a way to prevent auto binding of fields? i.e. In the
template project there are: public String title = "some text";
which someone can pass &title="something bad" into my page when I
don't want that.
You can define the field as private or protected and Click won't bind
it. You can also globally switch off autobinding in click.xml
with autobinding="false".
2) Can anyone point me at an example of a page that redirects to
itself adding a getRequestParameter to it's own URL before rendering?
I tried to do it with:
if (getContext().getRequestParameter("app") == null) {
getContext().setRequestAttribute("app", "default");
setForward(this);
// redirect to self without rendering...
}
in my onInit() method, but that doesn't bounce and just spins inside
my Tomcat server (also tried with setRedirect, I'm likely not doing
this right)
Ah, request parameter and request attributes doesn't affect each other.
Further the request parameters are immutable
and cannot be changed. Instead check the request attribute for the
presence of the "app" attribute:
if (getContext().getRequestAttribute("app") == null) {
...
}
That should break the recursive call.
Click 2.1.0 will support passing parameters to redirect:
Map params = new HashMap();
params.put("app", "default");
setRedirect(this, params);
kind regards
bob