Im trying JSF2 CDI (weld) beans in eclipse helios instead of ManagedBeans, but can't do the auto completion inside the expression language for my Named beans (the #{myNamedBean.Ctrl+Space} thingy)
But OTOH with ManagedBeans, the content assist works well ..
Is the content assist for CDI beans supported yet in Eclipse Helios?
Anybody got experiences in this ?
Install JBoss tools. Then by adding <nature>org.jboss.tools.jsf.jsfnature</nature> to the natures section of the .project file, the support improved in my Eclipse J2EE Helios edition. (This step is probably equal to Configure->Add JSF Capabilities in the project settings.) The context completion then works for cc.attrs.<ctrl-space> when building component compositions, but sadly still not for any #ManagedBeans.
Switch from ManagedBeans to CDI: I changed all #ManagedBeans to #javax.inject.Named and the scopes to #javax.enterprise.context.*Scoped etc. I also enable CDI Support in the project settings. Then I get context completion on beans in .xhtml!
First limitation: It only works when the EL is part of an attribute value. It does not work if you just use #{EL} somewhere else on the .xhtml page.
Second limitation: If you define the name of your bean via a constant, it is not recognized for context competion: Does not work: #Named(value = MyBean.BEANNAME). You have to set the name as a String, like: #Named(value = "myBean")
Third limitation: If you use parameterised method calls (e.g. with Tomcat7 or Glassfish), this is not supported by autocomplete. The autocomplete only shows get/set/is properties of the bean.
Note: It works out of the box in Netbeans 7.
If there is any support, it would be from JBoss Tools.
Before you install JBossTools, please note that for EL auto complete support and managed bean mapping all you need is these 2 components from the JBoss Tool set.
1. JBoss Tools JSF
2. JBoss Tools Visual Page Editor
If you do not select these specific tools then all the 20+ tools will get installed.
Also, note that sometimes your default file *.xhtml association will not change after tool installation. You may have to manually change file association preference. File>Preference>File Associations. Select *.xhtml and set "JBoss Tools Visual Page Editor" as the default editor.
Related
If I try to activate the "JPA Facet" for my Eclipse (Juno) project and point it to a user library containing the JPA libraries (in my case OpenJPA) I get the error:
"The class 'javax.persistence.Entity' is required to be in the selected libraries."
But this class is present there!
"Solution": The JPA libraries were contained in an Eclipse project folder. If I copy it somewhere outside and create another user library with them it works perfectly (although it has exactly the same content as the one before with the libraries located in the Eclipse project!). Seems like an Eclipse bug...
Just create a user library that contains the javax.persistence... JAR in it (It is located in Eclipse/plugins) and add this library at "JPA Implementation"
I'm using Spring Tool Suite (STS). The problem I was facing is that in the default installation the M2E-WTP plugin does not include the Optional component "m2e-wtp - JPA Configurator for WTP".
So I went to Help -> Eclipse Marketplace... and searched "m2e-wtp".
Click on the Installed button and it will become Change. Click on the Change button and select the optional component "m2e-wtp - JPA Configurator for WTP". Apply changes.
This solved for me.
I have this file of following content
#Managed by Liferay IDE (remove this comment to prevent future updates)
#Tue Jan 24 22:42:39 MSK 2012
app.server.portal.dir = D:\\APPS\\liferay-portal-6.1.0-ce-ga1\\tomcat-7.0.23\\webapps\\ROOT
app.server.lib.global.dir = D:\\APPS\\liferay-portal-6.1.0-ce-ga1\\tomcat-7.0.23\\lib\\ext
app.server.deploy.dir = D:\\APPS\\liferay-portal-6.1.0-ce-ga1\\tomcat-7.0.23\\webapps
app.server.type = tomcat
app.server.dir = D:\\APPS\\liferay-portal-6.1.0-ce-ga1\\tomcat-7.0.23
Hence I can either remove a comment and edit this file manually, or I can manage this file from Liferay IDE. Suppose I chose last option.
How to perform it? How to manage build.<username>.properties from within Liferay IDE (Eclipse)?
REPHRASE
In other words, under which circumstances the Liferay IDE writes paths into mentioned file, and where it takes these paths from?
AFAIK there's no specific UI for maintaining this file, but there are not too many items that typically get overridden. "Managed by Liferay IDE" means that Liferay IDE manages it by itself. If you want some changes in there by yourself, you can't have IDE manage it.
Remember: This is the file with the differences to build.properties. You should not change build.properties for better maintenance during upgrades - build.username.properties contains your private settings. Start from what Liferay IDE generates for you, then change it manually if required.
These values are written out from the configured Liferay Runtime that is set on a specific project. So before the SDK is used to perform a operation on a plugin, the values from the user's configured Runtime "Window > Prefs > Servers > Runtim environments" (specifically the liferay runtimes) are saved to the build..properties before the operation is invoked. That is if you have a project that is configured with Liferay Portal 6.1 runtime, then that path to the runtime will be used in the properties file.
See this code here.
Why is an application redeployment is needed for JSF managed bean modifications to take effect?
Development environment:
Eclipse Indigo.
JBoss as 7.
JBossAS Tools.
Further explanation:
If I modify a JSF page, I can visualize the modification after simply refreshing the page. But this is not the case for JSF managed bean modifications where I have to redeploy the application to visualize them.
Eclipse/JBoss cannot handle new classes, methods, nor fields during hotpublish/hotdeploy. They can however handle modified method bodies and values of non-static fields with help of JVM hot-swap.
JRebel plugin is able to handle new classes, methods and fields during hotdeploy, but not new managed bean registrations.
Please note that this all is unrelated to JSF. It's related to Java development in general and thus also affects all other kinds of Java frameworks/libraries whose code you basically try to edit "live".
See also:
Changes in .xhtml file not reflected in browser, restart and build needed
I solve like this Project -> Build Automatically
I well read the question How to find Spring XML definition from Java Class in Eclipse but it does not seem to answer similar question from me.
I would like to jump from Java class in editor to the spring context xml file.
If I highlighted a class declaration in editor, by pressing a shortcut key or clicking on some icon, it should open the corresponding spring context xml which have the bean initialization definition and jump to the line which initializes the bean "< bean id=... >". If I highlighted a set method in editor, it will do something similar but jump to where the property is set "< property name=method_name... >"
I am using Eclipse Java EE IDE for Web Developers Indigo SR2. I have installed Spring IDE Developers and SpringSource. I have added Spring nature to the project, added context xml to the project property Spring Beans Support Config Files, and could see the "S" on file icon decorator of the context file and java class, but I could NOT find a way to jump from the Java class to the spring context xml.
My colleague is using IntelliJ and they could see a bean icon in their editor next to class declaration. I would hope to see something similar on Eclipse. Ideally, not only class level, but also next to set methods.
Any advice will be much appreciated!
Thanks
Gerry
The desired action is provided by the Spring Tools (Spring Tool Suite), which can be installed the usual way, i.e. as Feature, or via the Eclipse Marketplace.
your current project needs the "spring project nature"
moreover, your build must include the "spring project builder"
and, in your project configuration project>properties, "Spring" tab, you need to define all your Spring XML files.
In Eclipse Mars, all of this will be setup automatically, when importing a Maven project and using the M2E plugin. Moreover, there is also a setting in the "Spring" tab, which allows to autodetect your Spring XML files. Anyhow, the spring project configuration needs to parse and evaluate those XML files during the incremental build of your project. So far for the prerequisites.
The actual function is called "open spring bean"
By default, there is no keybinding for this operation, so either
invoke it by name: press ctl-3 and start typing the name "open spring bean"
set up a custom key binding: press ctrl-shift-L and ctrl-shift-L again, to get the keybindings editor. Use the search to get to the function "open spring bean", make sure you select "in windows" as scope and add the key binding you like (e.y. I used ctrl-y, which is good to type with the left hand while using the mouse with the right hand).
This function will give you a Eclipse typical quick-hover-and-search box, where you can start typing. If the cursor is on the class name of the bean implementation Java class, the view will be populated already and you just need to hit enter.
<Rant>
This is such a crucial and basic feature. Why the Spring and Eclipse folks are incapable to set up and document the very basics in a way easy to discover is beyond me. No wonder every idiot thinks that IntelliJ is vastly superior, which it is not. In reality, both are on equal footing and have their strengths and weaknesses here and there.
</Rant>
I don't know if SpringSource or such have any specific keys for these, but good old Ctrl-shift-R (Navigate -> Open Resource) can be used to search for and open non-Java files in the workspace (like .xmls and .properties), for classes you can use Ctrl-shift-T (Navigate -> Open Type). When the search window opens, just start typing file- or class name (you can also use wildcards like * and ?).
Use Alt+Shift+B if you are using Spring Tools Suite.
I'm having troulbe enabling JSF in Eclipse. I have installed the WPT tools that should have had JSF included but when I right click on my project, properties, facets, enable facets I get a warning saying "Further configuration required" I click this, and I'm notified that "At least one user library must be selected" However there are no libraries to select.
I can optionally select "Disable Library Configuration" but I don't know what effects this might have as Eclipse is telling me that i must configure a user library.
Should I download a separate Jar from the Mojarra and add this to my build? Or can I safely disable. Why wasn't it included with WTP like it was supposed to be?
"At least one user library must be selected" However there are no libraries to select.
You have to prepare them yourself by Window > Preferences > Java > Build Path > User Libraries.
I can optionally select "Disable Library Configuration" but I don't know what effects this might have as Eclipse is telling me that i must configure a user library.
When you choose this option, Eclispe will also tell you that the user takes the responsibility of configuring the classpath appropriately via alternate means.
Should I download a separate Jar from the Mojarra and add this to my build? Or can I safely disable.
That's one of the alternative ways. Whether you need to download it yourself depends on the project's target runtime. If it's for example a simple JSP/Servlet container which does not ship with bundled JSF, such as Tomcat 7, then you indeed need to install it yourself. Just dropping the JAR(s) in /WEB-INF/lib is sufficient (or defining it as an user library, of course). Eclipse will automagically do the right things for you (adding to build path, including in exported WAR, etc). However, if it's for example a more full fledged Java EE container, such as Glassfish 3, then you don't need to do anything as it already bundles JSF as part of Java EE API. Just disable the library configuration altogether.
Why wasn't it included with WTP like it was supposed to be?
They have JSF tools included. They do however not include JSF libraries. Or did you read otherwise? If so, where exactly? It must have been a misinformation or misinterpretation.
See also:
JSF 2.0 tutorial with Eclipse and Glassfish
Download javax.faces-2.1.17.jar file and create a new library from manage library option and add the jar file in that library. Click apply, now it will work