Solved

JSF commandButton  --  method binding is not working

Posted on 2006-07-19
8
2,377 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 24

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 24

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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Short answer to this question: there is no effective WiFi manager in iOS devices as seen in Windows WiFi or Macbook OSx WiFi management, but this article will try and provide some amicable solutions to better suite your needs.
What is Backup? Backup software creates one or more copies of the data on your digital devices in case your original data is lost or damaged. Different backup solutions protect different kinds of data and different combinations of devices. For e…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

746 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

13 Experts available now in Live!

Get 1:1 Help Now