Re: Problem passing strings to my wrapper component
Re: Problem passing strings to my wrapper component
- Subject: Re: Problem passing strings to my wrapper component
- From: Kevin Windham <email@hidden>
- Date: Fri, 23 Feb 2007 09:40:45 -0600
On Feb 23, 2007, at 2:29 AM, Daniele Corti wrote:
2007/2/23, Kevin Windham <email@hidden>: I have a page wrapper and I've set up an API for it so I can pass some variables to it from the pages containing content. I have managed to pass Boolean values without any problem. In my .java file I put
public Boolean boolValue;
And in the API for the wrapper I have the name boolValue and value set is Boolean.
This works fine, I can inspect the wrapper in my content page and set the boolValue to true and my wrapper page responds appropriately.
However, if I do the same thing with a string, I get a null pointer exception. The only difference I can see is there is no option for String in the value set menu, so I just leave that unset. I imagine I am missing something, but I can't seem to find any leads on what it is. or append to the response
public void appendToResponse(WOResponse r, WOContext c) { //your code before append the component super.appendToResponse(r,c); //your code after appended the component }
This is what I was missing. I don't yet fully have my brain trained on the sequence of events that handles all the steps that go into creating and returning a page to the browser. I think part of my problem was blindly following a pattern I had learned from a lot of example code where a page is created in a preceding page and you can simply change the page constructor to do various things.
In this case, the pages are "talking" to each other and they are created before that conversation takes place so the results of the conversation were not available in the constructor. What I needed to do was wait until after the conversation and using appendToResponse is the function I needed to work with.
It is kind of cool to note that using a boolean with WO Builder and simply placing a WOConditional on my page that I can "tell" things to my wrapper without writing any code at all.
What I was trying to do in the first place was let my wrapper know what section of the site I was in so the wrapper could mark that section's button highlighted to give the user a visual clue where they are. My first thought was to pass a string with the section name to the wrapper and then in code set booleans to use with WOConditionals around the button images. It turns out that if I just put a bunch of booleans for each section I can bind them directly from the wrappee and not need any code at all. It's good to do the string exercise anyway though, since I have gained a little better understanding of how these subcomponents work.
Thanks, Kevin |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden