action 1 « Control « JSF Q&A





1. How can I execute Javascript before a JSF action is performed?    stackoverflow.com

If you have a JSF (which uses the onclick event of an to submit the current form), how do you execute Javascript (such as asking for delete confirmation) prior ...

2. JSF commandLink action firing before Updating Model Values    stackoverflow.com

I have a JSF application that consists of two JSPs: login.jsp & main.jsp. I have the following faces-config.xml:

<lifecycle>
  <phase-listener>package.programs.scorecard.beans.EventBean</phase-listener>
</lifecycle>
<managed-bean>
  <managed-bean-name>FormBean</managed-bean-name>
  <managed-bean-class>package.programs.scorecard.beans.FormBean</managed-bean-class>
  <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
  <managed-bean-name>DataBean</managed-bean-name>
  <managed-bean-class>package.programs.scorecard.beans.DataBean</managed-bean-class>
  <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
 ...

3. JSF Double Click perform action    stackoverflow.com

How can I execute a backing bean action when a user double clicks on a menu? e.g. using a selectManyListbox I assume I would need some javascript to execute a backing bean ...

4. action method is not called in JSF    stackoverflow.com

This is my Phase Listener

public class AdminPhaseListener implements PhaseListener {

private static final long serialVersionUID = -1161541721597667238L;

public void afterPhase(PhaseEvent e) {
    System.out.println("after Phase " + e.getPhaseId());
}

public void beforePhase(PhaseEvent e) ...

5. Which is better to be use JSF's Action event or Javascript?    stackoverflow.com

In my application i am enabling and disabling a button according to the value selected by the user from the <h:SelectOneMenu>. I am using a valueChangeListener for the same operation.My doubt ...

6. JSF 2.0: Action doesn't work    stackoverflow.com

I set up a JSF2.0 project with maven. Everything works fine exept action handling :-( Here is my .xhtml page:

<h:form>
   <h:commandButton
        id="submit"
  ...

7. JSF Action is not called    stackoverflow.com

Once again I have a problem which I can't find the solution to. A managed bean

@Named(value="changeInfoBean")
@RequestScoped
public class ChangeInfoBean {

    private String email;
    private String firstName;
  ...

8. how do i call a jsf action method (in JSF 1.2) using Ajax?    stackoverflow.com

I am writing a JSF 1.2 Application in Apache My faces. I cannot use any customized component library - like tomahawk or a4j and others. Is there a way to call ...

9. JSF2 ignores Action attribut    stackoverflow.com

my xhtml code:

<h:commandLink action="#{detailController.updateProject}" class="positive" >
 <h:graphicImage library="img" name="tick.png" alt=""/> 
 <h:outputText value="Save" />
</h:commandLink>
This action (updateProject()) is not being called from JSF framework! Even if I delete it in the managedBean ...





10. JSF - Change the action for a h:commandButton (2.0)    stackoverflow.com

Im new into JSF 2.0. On the last version i understand that if i want change rules about "what send to the client" i just need to configure the faces-config.xml. Now, on ...

11. Differences between action and actionListener    stackoverflow.com

What is the difference between action and actionListener. When sould I use action and/or actionListener? My question is related JSF 2.0.

12. Doing AJAX with JSF 2.0 without using action listeners    stackoverflow.com

I'm new to JSF. I am using JSF 2.0. I'd like to be able to use scripts that use ajax in a classical way, not going through JSF's f:ajax tag. However, I ...

13. action-to-action navigation in JSF 2    stackoverflow.com

I'm migrating from weblogic (struts extension) to JSF2. I wonder how can I navigate form one bean action to another bean action. In weblogic I would create and initialize form bean and I ...

14. JSF commandButton action returns proper value, but navigation rule doesn't apply    stackoverflow.com

Title pretty much says it all. I have a page called login.jsp:

<f:view>
  <html>
    <head>
      <meta http-equiv="Content-Type"
       ...

15. Invoking action method in the application startup (JSF)    stackoverflow.com

We need to call a action method while invoking the first page of the application. For example, the first page is index.jsp, when we are directly calling this page the action ...

16. Why does this ajax action not work with requestScope?    stackoverflow.com

package com.atlanticpkg.view.beans;

import com.atlanticpkg.controller.ejb.ContactsFacade;
import com.atlanticpkg.model.entities.Contacts;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;

@Named(value = "contactsBean")
@SessionScoped
public class ContactsBean implements Serializable {

    @EJB
    ContactsFacade contactsEJB;
    ...





17. popup is opened before the action    stackoverflow.com

<h:commandLink action="#{bean.action}" onclick="window.open('../note/note.faces', 'popupWindowName', 'dependent=yes, menubar=no, toolbar=no, height=450, width=700');">
In the above code popup is opened before action is completed when click the link. is it possible to open after action is completed? ...

18. call DownloadFileServlet on action of     stackoverflow.com

I want to download file which is not my server. for that i have made servlet but how to call from <h:commandButton> in JSF?

<h:commandButton value="PrePrint" action="{prePrintTemplateMaintenanceBean.downloadFile}"/>
in Bean file
public String downloadFile(){

   ...

19. JSF action not getting called on pressing enter    stackoverflow.com

I have a form containing 2 radio buttons. On clicking one of them, a page gets rendered[using jstl tags] which contains a text field and a drop down. The focus directly ...

20. JSF not working    stackoverflow.com

<h:commandButton action> is not working in following code snippest. bean(Employee.java):-

        public String deleteEmployee(){
        return "success3";
    ...

21. Popup window - perform the action and close    stackoverflow.com

I'm using popup window for code authentification, where are only following components:

<h:inputText value="#{bean.masterKey.code}" />
<h:commandButton action="#{bean.checkMaster}" value="OK" type="submit"/>
Button calls method checkMaster() which set the boolean variable true or false
public void checkMaster(){
  ...

22. h:commandButton action is just called one time on two calls    stackoverflow.com

I use JSF 1.2 on my web application. In my page test.xhtml, I have a form containing a commandButton like that :

<h:form>
  <h:commandButton action="#{myBean.myMethod}" value="Call my method" />
</h:form>
In java source, ...

23. JSF: Actions calls are delayed    stackoverflow.com

What could possible reasons be that my action calls are delayed? It happens for all action calls on one form I have. After I click on a anything that will call ...

24. JSF app, actions don't work if a different action has been invoked previously    stackoverflow.com

I'm learning Java EE 6 and JSF 2.0 on JBoss6 and have built a very simple 1 page "Todo" app which works but with a very strange bug. Tested in ...

25. h:commandLink action doens't fire within the same snippet that is to be replaced    stackoverflow.com

In the Question h:commandLink is not being invoked there are 7 issues mentioned. Now, I have the same problem, but I don't see which of the issues mentioned are causes ...

26. h:commandLink action doesn't fire in every click using JSF 2    stackoverflow.com

I have a masterLasyout.xhtml:

<h:form id="abc">
  <h1>
    <ui:insert id="abc1" name="title"></ui:insert>
  </h1>
  <p>
    <ui:insert id="abc2" name="body"></ui:insert>
  </p>
</h:form>
I have 2 snippets files (they are ...

27. commandLink action in ui:composition is not invoked    stackoverflow.com

i have page with menu in left side and content in the right every commandLink in left menu change the snippet of the content and activate function that update the current ...

28. Passing Object obtained in action method of one JSF view to another    stackoverflow.com

I am fairly new to JSF. Just trying to get a simple application working (which was previously written using another technology). The situation is that I have people going to starting ...

29. CommandButton action not worked in insideModalPanel    stackoverflow.com

h:commandButton action not worked in modalPanel. I am using t:inputFileUpload component for upload file. In my richModalPanel have one h:commandButton My requirement : After browse the file, and click ...

30. simple JSF commandButton not hitting the action    stackoverflow.com

I have the simplest little JSF example (JSF2 with GlassFish) and I can't figure out why the command button is not hitting the action method. This is what I have ...

31. When adding a faces message in JSF my actions aren't performed?    stackoverflow.com

I have the following backing bean:

@ViewScoped
@ManagedBean
public class WeighFamilyBacking2 implements Serializable {

private static final long serialVersionUID = 1L;
private String[] children = new String[] { "Child1", "Child2", "Child3" };
private HashMap<String, Integer> newWeights;

public WeighFamilyBacking2() ...

32. Display message for few moments before next action    stackoverflow.com

In JSF page I would like to display a message for a few seconds and then proceed with next action. e.g. If a record gets deleted, I would like to display ...

33. Why doesn't h:commandButton execute the action method when combined with c:chose?    stackoverflow.com

I've seen a strange problem in my project. It's that <h:commandButton/> does not execute the action method.

<c:choose>
   <c:when test="#{empty param.t}">
       // HTML
  ...

34. Calling action from the popup    stackoverflow.com

I am facing when i am opening a popup.

<h:form>
<h:commandButton value="Submit" action="#{bean.submit}">
    <f:ajax render="popup" />
</h:commandButton>

<h:panelGroup id="popup">
    <ui:fragment rendered="#{not empty bean.url}">
       ...

35. No Action when command button is clicked    stackoverflow.com

I have a problem with my JSF page which is request scope. I have a command button called "Seek" when clicked opens a page and user selects values and values are loaded ...

36. What's "allowed" in a method bound to action/outcome    stackoverflow.com

I know that theoretically one can put what he wants in the method, but I wanted to know if the method should not implement any logic other than defining a string ...

37. JSF2 execute two methods in action    stackoverflow.com

Is it possible to execute two methods in action of h:commandButton ?? for example

<h:commandButton action="#{bean.methodOne();bean.methodTwo();}" />

38. actions & targets    coderanch.com

40. Action's not performed on first time    coderanch.com

Friends, I have a search form created using JSF tags. In this form we have 7 buttons performing unique operations on the search form page. The problem is, when I come to this page for the 1st time and click on an any of the button. The page is submitted but no action is performed and the page returns back with ...

41. messages for an action    coderanch.com

Hi I've been trying to show messages as a result from an action. I think it's a natural way for an application to interact with the user, but haven't found it "natural" and easy to do in JSF. The messages are appended to the FacesContext, but when processing you have no access to the FacesContext. A validation method in a bean ...

42. Infinite Loop of action processing    coderanch.com

I have a jsp page in which I'm using h:commandButtons with the actin attributes set for navigation. I have a "reload" button that is congfigured to (via faces-config.xml) to go to a servlet, where some stuff is done to update data displayed in the original page, but then I get a request dispatcher and forward back to the original page. My ...

44. Creating Action from ValueChangeEvent    coderanch.com

45. where is the action class in JSF??    coderanch.com

A JSF backing bean is SORT OF like a Form Bean plus an Action Processor in a single JavaBean. However, unlike Struts objects, JSF backing beans are pure POJOs, and don't have to implement any interfaces or extend and classes. In fact, in many cases, you don't even call on JSF-specific services, nor create or access JSF specific objects. Ideally, not ...

46. Java ServerFaces in Action    coderanch.com

47. PhaseListener action not called    coderanch.com

49. Why doesn't my action method work?    coderanch.com

50. action method not invoked    coderanch.com

I have a managed bean with request scope with a jump() method public String jump() { System.out.println("Jump invoked"); return null; } public String someMethod() { currentItems = getCurrentItems(); return null; } and here is my jsf:- .... .... ..... When I press the "Jump" button, i get the text "Jump method invoked" ...

51. jsf does not has actions,right?    coderanch.com

52. Action method never gets called    coderanch.com

53. Custom Converter : no action    coderanch.com

54. Using HttpClient inside JSF action method.    coderanch.com

Configuration: jboss 4.2.0 GA, MyFaces 1.5.0. I`m trying to call executeMethod(GetMethod) on my HttpClient class to receive xml file and then parse it using JAXB. The exception i`m recieving is: 11:36:12,859 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception javax.servlet.ServletException: Exception while invoking expression #{Task.save} at javax.faces.webapp.FacesServlet.service(FacesServlet.java:154) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.bluemedia.topupInvoice.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:46) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147) ...

56. Problem in invoking the action method    coderanch.com

Hi All, I have 10 jsf pages in my application and the managed beans for them are some in session scope and some in request scope.All pages are functioning fine except the the first page which is in session scope.after key in the input if i hit enter key it is not invoking the backing bean's action method. But it is ...

60. execute javascript after action?    coderanch.com

This gets back to the issue about JSF being based on HTTP and HTTP being a request/response protocol. When you fire an Action, a request is made to the server. The request is processed as per the JSF lifecycle specs and a response is sent back to the client. The response is going to be a complete HTTP page. So the ...

61. Unable to call Action Methof    coderanch.com

62. Command Link Action Does'nt work    coderanch.com

63. Giving action to items in dropdowm.    coderanch.com

64. Action method is never entered/executed. Please help    coderanch.com

After submission, status.jsp goes through all phases successfully, but never enters/executes the action method i.e. #{statusManagedBean.createStatusAction}, can anyone please suggest any reason that could be the cause. Please see code below: JSF - status.jsp ================ <%@ page language="java" contentType="text/html;charset=UTF-8"%> <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%> <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%> <hutputText value="#{bundle.registerStatus}"/> ...

65. Action Event    coderanch.com

While using 'form.jsp', after pressing 'ADD', I do not find, 'listing.jsp' being loaded. The codes are as follows. form.jsp: <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>

Contact Form

<%-- First Name --%> ...

67. handling cancel action effectively    coderanch.com

68. Firing two actions    coderanch.com

Every action has an string that represents a logical outcome in the faces-config.xml. If you do not want to navigate to another resource, then an actionlistener. My suggestion is to delegate the business logic inside action1 and action2 to POJO classes, which could replace both actions with a single action that delegates processing to POJO classes. Of course, other managed bean ...

69. JSF action not getting called    coderanch.com

Hi, I'm hoping someone can help me troubleshoot what is going on. I have this JSF button on my page: But upon clicking it, the backing bean action is never called. Here is my definition in the faces-config.xml file: ConfigGridPage com.comcast.npsconfig.jsf.controllers.ConfigGridPage request elementName #{param.elementName} configKey #{param.configKey} configAction ...

70. PhaseListener getting the action    coderanch.com

76. Command Button Action not fired---Strange Issue    coderanch.com

This is my code The action is not fired in this case. But in all the following cases action is fired 1. If i give 2. Or if i put the scope of my backing bean as session, action ...

78. recursive JSF action    coderanch.com

79. h:inputText action problem.    coderanch.com

Hi guys, in my form there are 3 buttons, 2 of them are h:commandButton and 1 is a4j:commandButton. there is one h:inputText fild. when I write in input field, on press of enter I have to call the a4j:commandButton. but its not working. its just calling action of h:commandButton. I have also set the tabindex but its not working. what I ...

81. Dynamic Command Link action    coderanch.com

83. How to call a Action on onchange event in a Dropdown ?    coderanch.com

Onchange isn't an action, so you can't use an Action method for a change in a dropdown. However, you can use a ValueChangeListener. Aside from the difference in what method you define, there's also a difference in what it's safe to do in a ValueChangeListener, since the phase that actually sets the updated properties in the backing bean hasn't been done ...

84. action dostn't work    coderanch.com

85. How to create an action listner?    coderanch.com

86.  not consistently invoking action    coderanch.com

90. Multiple Actions issue in JSF    coderanch.com

Hi, Observed Multiple Action issue in JSF page, 1. I have a h:commandLink (called "fileAttachmentLink") in my JSF page (approveFiles.jsp) 2. if I click the commandlink it will download a PDF file and display the prompt to open or save. Everything works fine until this point. 3. Now if I go to my JSF page (approveFiles.jsp) and try to do other ...

91. Chrome JSF Actions Problem    coderanch.com

93. h:commond button's action does'nt work    coderanch.com

94. Get the return value of ajax action    coderanch.com

95. problem with action    coderanch.com

96. How to invoke an action in jsf using ajax    coderanch.com

I believe what you really want is "onchange", not "onclick". If you do brute-force AJAX, your AJAX method will have to manually extract the new value from the listbox and send it to the server, and the server will need an appropriate URL handler - you can't just expect a JSF action method to be fired. RichFaces, IceFaces, and several other ...

99. h:commandButton action not working    coderanch.com

This problem is only appearing in IE. It is a seam project (version 2.2.2EAP5) with JSF1.2 The button appearing at the bottom of this page #{messages['ond.label.sitecode']} [...other search criteria deleted for readability....]