|
|
Re: pagecode sync [message #663877 is a reply to message #663790] |
Wed, 06 April 2011 16:48 |
|
On 06-Apr-11 08:04, Ben wrote:
> Is there anyone who could provide some insight on this? If you use WTP,
> you should at least be able to tell me if you have to manually edit your
> pagecode or not.
>
> How do you Eclipse users deal with this?
>
> Thanks!
http://projectlombok.org/ ?
|
|
|
|
Re: pagecode sync [message #663971 is a reply to message #663901] |
Thu, 07 April 2011 01:35 |
|
On 2011.04.06 12:41, Ben wrote:
> Thanks for the response Russell! However, that doesn't answer my
> question. lombok looks like a neat concept, but will it automatically
> update your java pagecode with getters and setters when you add a new
> component to your jsf page?
>
> For you JSF programmers out there, how do you manage your pagecode?
I'm sure there's something I'm just not seeing.
Lombok works on any Java class you create.
Unlike JSP, there is no Java code in a JSF page; instead, the JSF code
consumes a Java (managed) bean interfaces. By definition, since the
bean's already been "Lombokized", you're free to consume the getters and
setters Lombok created. The "new component" you add to your JSF page is
none other than such a bean, no?
There's a specific JSF forum at eclipse.org. Its NNTP name is e.w.jsf.
You might get more expert JSF help there.
|
|
|
|
|
|
Re: pagecode sync [message #666942 is a reply to message #665157] |
Sun, 24 April 2011 20:41 |
arjan Messages: 3 Registered: July 2009 |
Junior Member |
|
|
Ben wrote on Wed, 13 April 2011 09:36 | Yah, that's what I was thinking. So when you guys make changes to your jsf pages, do you manually create your getters and setters in your backing bean?
|
I've been in JSF development for some time, but I've haven't really heard about the term "pagecode". It also seems a little awkward to me that you want getters and setters for components you use on your view with a reference in Java to those components' local ID.
There sometimes is a need for binding components to a backing bean, but A) this is relatively rare, and B) this is not what the example you gave demonstrates.
So the answer is: "we" don't create getters and setters at all for components, not automatically and not manually.
The workflow is typically the other way around. In a backing you create some member variable, e.g. String foo:
@FacesComponent
public class MyBacking {
String foo; // <--- Just added
}
Then Eclipse generates the getters/setters:
@FacesComponent
public class MyBacking {
String foo;
public String getFoo() { // <--- generated by Eclipse
return foo;
}
public void setFoo(String foo) { // <--- generated by Eclipse
this.foo = foo;
}
}
Then, Eclipse/WTP autodiscovers the newly added getters/setters and makes them available in EL on a Facelet:
<!-- in Eclipse, myBacking. will show "foo" as autocomplete option -->
<h:inputText value="#{myBacking.foo}"/>
|
|
|
|
Powered by
FUDForum. Page generated in 0.04263 seconds