Solved

JSF commandButton  --  method binding is not working

Posted on 2006-07-19
8
2,381 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now