0

I have a problem with to show images into a <p:dataTable>. I'm following the BalusC's instructions here but when I try use context.getCurrentPhaseId() as follows,

FacesContext context = FacesContext.getCurrentInstance();

if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
    return new DefaultStreamedContent();
}

Then Eclipse shows the following compilation error on context.getCurrentPhaseId():

The method getCurrentPhaseId() is undefined for the type FacesContext

How is this caused and how can I solve it? I'm using JSF 2 and Primefaces 2.2-snapshot.

Community
  • 1
  • 1
leoJerez
  • 55
  • 1
  • 8

1 Answers1

0

The method getCurrentPhaseId() is undefined for the type FacesContext

That method was introduced in JSF 2.0. This compilation error thus suggests that you're actually using JSF 1.x or at least are compiling against JSF 1.x instead of JSF 2.x. As PrimeFaces 3.x is not compatible with JSF 1.x, this in turn suggests that your IDE project is at incorrectly referencing a JSF 1.x library in the build path and thus you're actually compiling against JSF 1.x.

Check the project's Build Path property and get rid of that JSF 1.x library. In fact, you should never have the need to fiddle around in project's Build Path property. Just setting the Deployment Assembly and/or Targeted Runtime right, and/or dropping the necessary JARs in /WEB-INF/lib folder should really be all what you ever need to do as to library management.

BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
  • Thanks for your answer. Ok, I have the javax.faces-2.2.1.jar and primefaces-2.2-SNAPSHOT.jar. Sorry, but I did wrong with the Primefaces version posted. What can I do in this situation? – leoJerez Nov 27 '13 at 18:23
  • As answered, remove JSF 1.x from build path. – BalusC Nov 27 '13 at 18:35
  • But I don't know which jar I need delete, because I only have these .jar that I said and if I remove it the project doesn't work. Please, can you help me? I am very newer. When I'd review into project facets I see that have JSF 2.1, this is the problem? because I can't change that property to JSF 2.2 By the way, thanks for your corrections in the post and excuse me for my english. – leoJerez Nov 27 '13 at 19:05