Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hi i am new to the JSF technology and i have faced a problem on my AppActionListener  RSS feed

anbu alagan
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am currently using the java studio enterprise 8 plattform, jdk 1.5.0
application server 8.1 UR2 and the jsf 1.1 reference implementation.

The problem is that it gives 3 errors which are the following:
cannot import javax.faces.tree because it seems that the package is not existed in the library.

The other error is that it cannot find the symbol for the method
String actionCommand = event.getActionCommand();

The final error is that it cannot find the symbol for the method

My packages javax.faces.event.ActionEvent and javax.faces.application.Application seem to work fine.

import java.util.Iterator;
import javax.faces.FactoryFinder;
import javax.faces.application.Application;
import javax.faces.application.ApplicationFactory;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;
import javax.faces.event.PhaseId;
import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.tree.Tree;
import javax.servlet.ServletContext;

public class AppActionListener implements ActionListener {
public PhaseId getPhaseId() {

public void processAction(ActionEvent event) {
String actionCommand = event.getActionCommand();
if ("buy".equals(actionCommand)) {
FacesContext facesContext = FacesContext.getCurrentInstance();
String productId = (String) facesContext.getExternalContext().
ShoppingCartBean cart =
(ShoppingCartBean) getValueBinding("ShoppingCartBean").
ProductBean product = getDatabaseUtil(). getProductDetails(productId);
ShoppingItemBean shoppingItem = new
ShoppingItemBean(product.getId(), product.getName(), product.getPrice(), 1);
else if ("order".equals(actionCommand)) {
// insert a record into the database
FacesContext facesContext = FacesContext.getCurrentInstance();
OrderBean order = (OrderBean)
ShoppingCartBean cart = (ShoppingCartBean)
getDatabaseUtil().insertOrder(order, cart);
// empty shopping cart


private ValueBinding getValueBinding(String valueRef) {
ApplicationFactory factory =
Application application = factory.getApplication();
return application.getValueBinding(valueRef);

private DatabaseUtil getDatabaseUtil() { FacesContext
facesContext = FacesContext.getCurrentInstance();
ServletContext servletContext = (ServletContext) facesContext.getExternalContext().getContext();
return (DatabaseUtil)

If anyone knows anything about what it might be responsible for these errors please let me know.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!