Solved

JSF commandButton  --  method binding is not working

Posted on 2006-07-19
8
2,386 Views
Last Modified: 2012-06-21
this question is regarding JSF

below is my part of JSF

 <h:commandButton id="create" type="submit" action="#{feedBack.create}" alt="#{bundle.buttonPost}" image="#{facesContext.externalContext.requestContextPath}/HTML-INF/images/buttons/post_button.gif"/>




here is my faces-config

<managed-bean>
<description>Feedback Bean</description>
<managed-bean-name>feedBack</managed-bean-name>
<managed-bean-class>com.vrx.web.bean.FeedBackRecordBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>



and finally FeeBackRecordBean create method


     public FeedBackRecordBean()
     {
          LogManager.getPlatformLogger().log(Level.INFO, "FeedBackRecordBean Constructor");
          this.reset();
     }

public String create() {

log(Level.INFO, "FeedBackRecordBean create Begin");

sendEmail();

return null;
}

I don't know why the JSF is not able to invoke the create method
any kind of help would be appreciated
I can see the log that is inside the constructor but not the one in create method

what i observed is that text fields are invoked, but not the method
so method binding is not working, i double checked spelling
where else can i check i have gone wrong

thanks
0
Comment
Question by:geekprog
  • 4
  • 2
8 Comments
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 17146381
     Hi!

public String create() {

 LogManager.getPlatformLogger().log(Level.INFO, "FeedBackRecordBean create Begin");

sendEmail();

return null;
}

Regards,
  Tomas Helgi
0
 
LVL 1

Author Comment

by:geekprog
ID: 17148179
LogManager.getPlatformLogger()  -- already exists in my code, i just removed it in this post to make it short
0
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 17148439
try
public String create() {

 LogManager.getPlatformLogger().log(Level.INFO, "FeedBackRecordBean create Begin");

sendEmail();

return "";
}

If you are using the returned string value ( in your case null ) in comparison like String.compareTo(.) or Integer.parseInt(str) you will get NullPointerException.

Regards,
   Tomas Helgi
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:geekprog
ID: 17148627
yeah, i tried

return "";
and
return "dfault";


but my understanding is that method itself is not getting invoked. Since i am not able to see the log statement that is inside the method printed on the console

while i was able to see the log statements that are inside the Constructor

---
and coming back to JSF

i have included this JSF in another JSP using tiles

in that scenario, is there anything i need to know about method binding
or about using   f:view tags

what i was thinking is since my JSF is included in another JSP, i was wondering does the request URL goes back ?  i mean to say that different URL ( original page URL ) might be going back instead of my JSF ( i don't know, what i am talking, i am not that good )
0
 
LVL 1

Author Comment

by:geekprog
ID: 17164157
I will put my question in simple way


can anybody give me some ideas about debugging JSF method binding

i have a java bean, which also contains a method which will email to me

and i am calling this method in my JSF using method binding
and i have a print statement in my method, which doesn't print in the console
which means this method itself is not getting called

i have included this java bean in configuration file

what else do i need to make sure and any other debugging ideas ?
0
 
LVL 1

Author Comment

by:geekprog
ID: 17170635
I solved my problem myself

In my JSF, i have used couple of fields, which includes Date field

In JSF, you have to do conversion for Date and other non String fields. Since it displays only Strings. Read JSF tutorial more about it if you guys wanted to know. That was the reason, my method binding was not working and it wasn't displaying any errors too. Had a tought time debugging this.

I hope my points get refunded to ask more questions

thanks
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 17399952
PAQed with points refunded (350)

GhostMod
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Always backup Domain, SYSVOL etc.using processes according to Microsoft Best Practices. This is meant as a disaster recovery process for small environments that did not implement backup processes and did not run a secondary domain controller that ne…
In order to fulfill our mission of inspiring learning in the technology community, Experts Exchange is launching a Course of the Month program. Premium and Team Account members will have access to one course per month as a part of their membership, …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question