Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » pagecode sync(Does WTP keep page code in sync?)
icon5.gif  pagecode sync [message #660474] Fri, 18 March 2011 15:04 Go to next message
Ben is currently offline Ben
Messages: 8
Registered: March 2011
Junior Member
Greetings!

We are currently using RAD 7 and are very interested in moving to Eclipse. RAD has a handy feature that allows you to modify your page while automatically updating the pagecode with the appropriate getters and setters. So far, we've not found anything in Eclipse (plugin or otherwise) that will do this for us.

Does anyone know of a way in Eclipse to have your pagecode automatically updated for you? Surely you guys using Ecplise don't go in and manually add/remove/change getters and setters for your page components, or do you???

Thanks a bunch!
Re: pagecode sync [message #663790 is a reply to message #660474] Wed, 06 April 2011 14:04 Go to previous messageGo to next message
Ben is currently offline Ben
Messages: 8
Registered: March 2011
Junior Member
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!
Re: pagecode sync [message #663877 is a reply to message #663790] Wed, 06 April 2011 16:48 Go to previous messageGo to next message
Russell Bateman is currently offline Russell Bateman
Messages: 3221
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

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 #663901 is a reply to message #663877] Wed, 06 April 2011 18:40 Go to previous messageGo to next message
Ben is currently offline Ben
Messages: 8
Registered: March 2011
Junior Member
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?
Re: pagecode sync [message #663971 is a reply to message #663901] Thu, 07 April 2011 01:35 Go to previous messageGo to next message
Russell Bateman is currently offline Russell Bateman
Messages: 3221
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

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 #664155 is a reply to message #663971] Thu, 07 April 2011 16:20 Go to previous messageGo to next message
Ben is currently offline Ben
Messages: 8
Registered: March 2011
Junior Member
We are using JSF pages. I probably could have mentioned that sooner Smile. In RAD, the managed bean for a particular JSF page is automatically updated by RAD when ever you modify the JSF page.

For instance, if I add <h:outputText id="myNewField".... />, RAD will automatically add this to the pagecode (backing managed bean)...

protected HtmlOutputText myNewField;

protected HtmlOutputText getMyNewField(){
if(myNewField == null){
myNewField = (HtmlOutputText)findComponentInRoot("myNewField");
}
return myNewField;
}


In Eclipse, I would have to write the member variable and getter method manually. I was hoping that there might be a way in Eclipse to have it do this automatically.

Thanks for the tip on the other forum, I'll try that one too!
Re: pagecode sync [message #665038 is a reply to message #664155] Wed, 13 April 2011 02:44 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2310
Registered: July 2009
Senior Member
To the best of my knowledge, there is no such feature in WTP.

---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: pagecode sync [message #665157 is a reply to message #665038] Wed, 13 April 2011 13:36 Go to previous messageGo to next message
Ben is currently offline Ben
Messages: 8
Registered: March 2011
Junior Member
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?
Re: pagecode sync [message #666942 is a reply to message #665157] Sun, 24 April 2011 20:41 Go to previous messageGo to next message
arjan is currently offline 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}"/>










Re: pagecode sync [message #667012 is a reply to message #666942] Mon, 25 April 2011 14:09 Go to previous message
Ben is currently offline Ben
Messages: 8
Registered: March 2011
Junior Member
Thanks arjan!

There is a good chance that since we have used an IBM version of JSF and RAD for so long, we have probably taken a number of things for granted and misunderstood the inner workings of JSF. With that in mind, some of my questions may not make sense or might be something that every beginner would know. Bear with me please Smile.

I'm guessing that "pagecode" is an IBM term. It sounds like "backing bean" is better?

I would assume that most components on a JSF page that you care about are tied to an EJB, so having a reference to the actual component is rarely needed. However, in those cases that it is, you must provide an ID for that JSF component, and provide getters and setters in the backing bean. Is that correct? And you would code this yourself?

For instance, say you have a validate method in the backing bean that validates several different components at once. You would need to have at least getters for the ones you care about (except for the one the validator is assigned to of course).

Thanks again for your feedback!
Previous Topic:JSP: Tag library Intellisense problem in Eclipse 3.6 Helios
Next Topic:Unable to uninstall facet
Goto Forum:
  


Current Time: Thu Oct 23 01:44:09 GMT 2014

Powered by FUDForum. Page generated in 0.02132 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software