dev@jsftemplating.java.net

Re: JSFTemplating: Re: jsftemplate debugging advise needed

From: Anissa Lam <Anissa.Lam_at_Sun.COM>
Date: Fri, 15 Aug 2008 17:29:46 -0700

Hi Rebecca,

Rebecca Searls wrote:
>
> I have subscribed to dev_at_jsftemplating and will post there.
>
> Anissa and Ken,
>
> To follow up with your questions and suggestions.
>
> > Just wondering, are you using the one in V2 or V3 ?
> Using v2_ur1
>
> > There should be the handler map known as
> META-INF/jsftemplating/Handler.map in your jar.
> I do see this file but my UserHandlers file is not referenced there.
> I looked at the
> adminGUI Handler.map and see their handlers there. I must be doing
> something wrong in the
> build.
>
> I must be missing the apt step. I will review the pom.xml Ken sent
> and see if I can find
> the missing piece. Also it appears I must create a JAR file of the
> classes that goes into
> the WAR file. I will correct this and try again.
>
>
> > println("Calling getMapUserInfo ");
> > getMepUserInfo(selectedRows="$attribute{selectedRows}"
> result=>$attribute{listOfRows} );
> > println("getMapUserInfo() returns ${listOfRows}");
>
> I added these print stmts, rebuilt, redeployed. I don't see any
> messages. Where should I see
> them, in the server.log?
Yes, it should be server.log.
If you don't see this in server.log, it means this beforeCreate event
is not even executed. That also explains why you didn't see any
exception even though the Handler.map doesn't list out your
getMepUserInfo() but you are referencing that in your .jsf
Are you sure you are requesting this file ?

Anissa.

>
>
>
>
>
>
> Anissa Lam wrote:
>> Hi Rebecca,
>>
>> Besides sending to me, you may want to send to dev_at_jsftemplating
>> alias as well so you can get advice from other members.
>> Please see my comments inline and suggestion at the end.
>>
>> Rebecca Searls wrote:
>>> Anissa,
>>>
>>> I need advise on how to debug the MEP admin screens. It does
>>> not appear my
>>> jsftemplate handler method is ever getting called. I'm trying
>>> to track down
>>> the problem. I've looked for advise on the jsftemplate project
>>> site but have
>>> not found any helpful information. What do you suggest?
>>>
>>> I'm using NB 6.1. I created a maven2 project. I defined a
>>> couple of
>>> screens using the GF jdbcConnectionPool.jsf and
>>> JdbcHandlers.java as the model.
>> Just wondering, are you using the one in V2 or V3 ?
>>> I created a UserHandlers.java class with a single annotated
>>> method, getMepUserInfo.
>>> As in jdbcConnectionPool.jsf right after the setResourceBundle
>>> stmt method
>>> getJDBCConnectionPoolMaps is called, I instead call
>>> getMepUserInfo. The code
>>> compiles cleanly and the war deploys and runs without exceptions
>>> (i.e. the defined
>>> screen components display successfully). I have the following
>>> jsftemplating files
>>> in my local maven repository and they get pulled into the war file.
>>>
>>>
>>> jsf-api-1.2_07.jar
>>> admin.jar jsf-impl-1.2_07.jar
>>> admin-en.jar jsftemplating.jar
>>> admin-jsf.jar jsftemplating-dt.jar
>>> jsftemplating-dynafaces-0.1.jar
>>>
>>>
>>> In my web.xml file I set com.sun.jsftemplating.DEBUG to true. I
>>> though I would see
>>> debugging information in the server.log file but didn't. I
>>> added print stmts to
>>> my method getMepUserInfo but see no output to server.log either
>> Another convenient method to use for debugging is to use the
>> println() handler in your .jsf file.
>> You can add
>> println("I am about to call getMepUserInfo");
>>
>> or
>> println("getMepUserInfo returns $attribute{listOfRows}");
>>
>> or
>> println("in beforeCreate");
>>
>> so you know what event is processed or result from your handler etc.
>>>
>>> I found on the jsftemplating site that a UserHandlers.map file
>>> should get generated
>>> at build time but I don't see one. I looked for a
>>> JdbcHandlers.map file in the
>>> adminGUI_war but did not find one. Not sure how to interpert this.
>> There should be the handler map known as
>> META-INF/jsftemplating/Handler.map in your jar. Do you have this ?
>> Can you send us the build script on how your project is built, maybe
>> you are missing the annotation processing ?
>> However, normally if this map file doesn't exist and you are calling
>> the method, you will get an exception, but you said you don't get any
>> error and the page shows fine. Thats what i can't explain.
>> Please put the debug statement in your jsf to see how it goes.
>>>
>>>
>>> The only method in UserHandlers.java
>>>
>>> @Handler(id="getMepUserInfo",
>>> input={
>>> @HandlerInput(name="selectedRows", type=List.class)},
>>> output={
>>> @HandlerOutput(name="result", type=java.util.List.class)}
>>> )
>>>
>>> public static void getMepUserInfo(HandlerContext handlerCtx) {
>>> System.out.println("Entered getUserInfo");
>>> List<Map> selectedList =
>>> (List)handlerCtx.getInputValue("selectedRows");
>>> }
>>> The call to getMepUserInfo in userAccountsGeneral.jsf
>>>
>>> <sun:page id="page1">
>>> <!beforeCreate
>>> setResourceBundle(key="i18n"
>>> bundle="com.sun.enterprise.tools.admingui.resources.Strings");
>>> setResourceBundle(key="msg"
>>> bundle="com.sun.i18n.adminResources")
>>>
>> println("Calling getMapUserInfo ");
>>> getMepUserInfo(selectedRows="$attribute{selectedRows}"
>>> result=>$attribute{listOfRows} );
>> println("getMapUserInfo() returns ${listOfRows}");
>>
>>
>> Let's see how the above suggestion goes.
>> Anissa.
>>>
>>> setPageSessionAttribute(key="editLink"
>>> value="/userAccts/userEdit.jsf");
>>> setPageSessionAttribute(key="createLink" value="userNew.jsf");
>>> setPageSessionAttribute(key="listPageLink"
>>> value="/userAccts/userAccountsGeneral.jsf");
>>> setPageSessionAttribute(key="resourceType"
>>> value="userAccountsGeneral");
>>> />
>>
>