?
Solved

JSF commandButton  --  method binding is not working

Posted on 2006-07-19
8
Medium Priority
?
2,393 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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!

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Learn how to use the free Acronis True Image app to easily transfer data between iPhones and Android phones.
The top devops trends for 2017 are focused on improved deployment frequency, decreased lead time for change and decreased MTTR.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

771 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