Re: pulling my hair out:)
Vic Cekvenich <[email protected]>
| Newsgroups | gmane.comp.java.mvc.devel |
|---|---|
| Message-ID | <[email protected]> |
Not sure where to start, what string to pull on. I am not sure if you
are inserting a new or populating.
Consider doing modular, break the problem into simpler parts.
Unit test the bean ( It always works for me).
So your bean should have a String test it method. Inside of it code your
populate, insert, get,set, save etc.
Call the testit method from a servlet.
This should confirm that the bean works 100% beyond any doubt.
Now you can tackle the integration. I find by doing this step, my
frustration decreases and productivity (modules per day) increases.
(also, more samples added in CVS in addition to the 0.8k release on sf.net).
hth,
.V
Rick Reumann wrote:
> Ok I'm pulling my hair out trying to figure where I'm screwing up. Any
> suggestions from anyone I'll take:)...
>
> Here's the situation... I'm new to the bP framework but I'm giving it a
> whirl. To start with all I'm trying to do is set up a very simple
> ItemRequestBean where a user can type in a text field "requestedBy."
>
> I created an ItemRequestAct (extends BaseAct) that has a method
>
> public String onSetupExec(ActEvent ae)
>
> My html form has
>
> <html:text property="requestedBy"/>
>
> which of course ends up calling in my ItemRequestBean:
>
> public String getRequestedBy() {
> return getValue("requestedBy");
> }
>
> The problem is the HasMap _current is always null when it ends up being
> checked from this form which causes the page to crap out. To prevent
> _current from being null I tried this in my onSetupExec...
>
> BaseBean itemRequest = new ItemRequestBean();
> itemRequest.populate(null);
> ae.setBean(itemRequest)..");
>
> Where populate(null) ends up calling my ItmeRequestDAO and I just
> hardcoded in:
>
> HashMap map = new HashMap();
> map.put("requestedBy","Loser");
> ArrayList list = new ArrayList(1);
> list.add( map );
> return list;
>
> so _current ends up being set. I can test for the _current right before
> the execute method of BaseAct returns and everything is fine (the debug
> below will print "Loser")
>
> BaseBean b = ae.getBean();
> log.debug("b.getValue('requestedBy') = "+b.getValue("requestedBy") );
> return mapping.findForward(forward);
>
> So from the above it looks like it's leaving the Action correctly and
> _current must be set fine or else the getValue("") wouldn't work.
>
> I have some error logging code in the getValue() method and when it gets
> to the jsp page and the property="requestedBy" triggers
> getValue("requestedBy") to be called I see in the log file that
>
> _current is null so of course _current.get(a) will not work and
> everything dies.
>
> What along the way is setting the _current HashMap back to null?
>
> Thanks so much for any insight. Maybe tomorrow it will jump out at me,
> but for today it's driving me nuts.
>