Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

No access to JSF components in XHTML file and EL expression doesn't work in Eclipse

 
Volodymyr Lysenko
Ranch Hand
Posts: 511
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have my managed bean added correctly in faces-config.xml.
EL expression works in "New JavaServer Faces (JSF) Page (xhtml, xml syntax)" (I have this option after I select new JSP file) but not in "New Facelet Footer" (when I select new HTML) page!
When I create html page with "New Facelet Footer" I have to add next lines but it doesn't give needed jsf components via Content Assist

I take any possible option to create html with JSF like: "New Facelet Composition Page", "New Facelet Footer", "New Facelet Header", "New Facelet Template" but in any case I don't have EL expression working.
With classpath I have everything good because I have access to jsf components in jsp file.
When I create "New JavaServer Faces (JSF) Page (xhtml, xml syntax)" I have access to all jsf components (h: and f: libraries) and EL expression works well
but when I open my ready page in System editor it prints that there is mistake on line 2 column 2. Here is my small JSP file:

Here is what I have in System Editor:

Please, tell how you create new HTML page(but not jsp) with jsf components, if it is possible of course, or maybe you know what to do with mistake
on column 2 line 2. I have el expression working only on "New JavaServer Faces (JSF) Page (xhtml, xml syntax)" (after I select new JSP file in "Select a wizard" dialog).
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18098
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't a JSF problem, it's an IDE problem. Moving to IDEs Forum.
 
Volodymyr Lysenko
Ranch Hand
Posts: 511
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This problem is solved now!

I had to do the following things to enable EL expressions:

1) place my project into workspace(File -->Switch Workspace) but not import it from anywhere
2) then import project into eclipse using File -->Import -->Import existing Maven project
3) add managed bean in Managed Bean tab in faces-config.xml. To have this faces-config.xml you should do the following:

a) right click on name of project. Choose "Properties". There select node Project Facets. In window on the right select following check boxes: Java, JavaScript, JavaServer Faces, Dynamic Web Module! Click OK. In WEN-INF you should see faces-config.xml with many tabs below. Select "Managed Bean" tab and add your managed bean.

To make all this work I also had to download "apache-maven-3.0.4" version. Then I had to add this new version to eclipse doing this:
Window -->Preferences -->Maven -->Installations --> Add(button).
Also I had to change location of .m2/repository from C://Documents and Settings/Admin/ and specify new location in User Settings(located below Installations)
To change location of maven repository it is needed to add following element to settings.xml under {maven-home}/conf directory

because I moved repository to D:/.m2/repository
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for sharing your solution!

WP
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic