dev@jsftemplating.java.net

Re: JSFTemplating: Re: jsftemplate debugging advise needed

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Fri, 15 Aug 2008 13:44:11 -0700

Anissa's advice is good... follow her suggestions. :)

Ken

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");
>> />
>