You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Karl Kildén <ka...@gmail.com> on 2014/09/04 22:30:51 UTC

Decide what to rerender on server side?

Primefaces offers several ways to do client side stuff from the server. For
examples see here:
http://www.primefaces.org/showcase/ui/misc/requestContext.xhtml

While I use primefaces I prefer to keep my hands out of the cookie jar with
stuff like this. I mean a datepicker can be replaced with a js widget in 20
minutes if you use a composite component that wraps primefaces date picker.
However this stuff would be painful to replace.

So my question is, could this be done in some way with JSF or myfaces-impl?

cheers

Re: Decide what to rerender on server side?

Posted by Thomas Andraschko <an...@gmail.com>.
FacesContext.getCurrentInstance
<http://grepcode.com/file/repo1.maven.org/maven2/com.sun.faces/jsf-api/2.0.4-b09/javax/faces/context/FacesContext.java#FacesContext.getCurrentInstance%28%29>().getPartialViewContext
<http://grepcode.com/file/repo1.maven.org/maven2/com.sun.faces/jsf-api/2.0.4-b09/javax/faces/context/FacesContext.java#FacesContext.getPartialViewContext%28%29>().getRenderIds
<http://grepcode.com/file/repo1.maven.org/maven2/com.sun.faces/jsf-api/2.0.4-b09/javax/faces/context/PartialViewContext.java#PartialViewContext.getRenderIds%28%29>().add
<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/java/util/Collection.java#Collection.add%28java.lang.String%29>("myPanel");



2014-09-05 8:34 GMT+02:00 Karl Kildén <ka...@gmail.com>:

> Hi Howard,
>
> Well they use custom ajax so not sure it would be very easy to understand
> but eventually I will look at it yes :-) Still interested in hearing some
> pro input from myfaces guys first
>
> Can you link me the feature in omnifaces? I cannot find it. Regarding
> primefaces I don't want to be to dependent on frameworks as hinted in my
> first email.
>
>
> On 5 September 2014 00:33, Howard W. Smith, Jr. <sm...@gmail.com>
> wrote:
>
> > Karl, you could look at PrimeFaces requestContext implementation (source
> > code).
> >
> > also, you can maybe ask for something like this to be added as a feature
> > request in MYFACES JIRA.
> >
> > Is there any reason why you prefer not to use PrimeFaces requestContext
> or
> > the similar feature that is available in OmniFaces library?
> >
> >
> >
> > On Thu, Sep 4, 2014 at 4:30 PM, Karl Kildén <ka...@gmail.com>
> wrote:
> >
> > > Primefaces offers several ways to do client side stuff from the server.
> > For
> > > examples see here:
> > > http://www.primefaces.org/showcase/ui/misc/requestContext.xhtml
> > >
> > > While I use primefaces I prefer to keep my hands out of the cookie jar
> > with
> > > stuff like this. I mean a datepicker can be replaced with a js widget
> in
> > 20
> > > minutes if you use a composite component that wraps primefaces date
> > picker.
> > > However this stuff would be painful to replace.
> > >
> > > So my question is, could this be done in some way with JSF or
> > myfaces-impl?
> > >
> > > cheers
> > >
> >
>

Re: Decide what to rerender on server side?

Posted by Karl Kildén <ka...@gmail.com>.
Thanks guys! <3


On 5 September 2014 12:51, Howard W. Smith, Jr. <sm...@gmail.com>
wrote:

> http://showcase.omnifaces.org/utils/Ajax
>
> click the AjaxBean tab in the Source code panel on the showcase page (see
> below)
>
>
> import org.omnifaces.util.Ajax;
> @ManagedBean@RequestScopedpublic class AjaxBean {
>
>     public void update() {
>         Ajax.update("form:timestamp");
>     }
>
>     public void callback() {
>         Ajax.oncomplete("alert('Hi, I am the oncomplete callback
> script!')");
>     }
>
>     public void argument() {
>         Ajax.data("foo", "bar");
>         Ajax.data("first", "one", "second", "two");
>         Map<String, Object> data = new HashMap<>();
>         data.put("bool", true);
>         data.put("number", 1.2F);
>         data.put("date", new Date());
>         data.put("array", new Integer[] { 1, 2, 3, 4, 5 });
>         data.put("list", Arrays.asList("one", "two", "three"));
>         data.put("beans", Arrays.asList(new ExampleEntity(1L, "one"),
> new ExampleEntity(2L, "two")));
>         Ajax.data(data);
>         Ajax.oncomplete("showData()");
>     }
>
>     public void updateRow(UIData table, int index) {
>         Ajax.updateRow(table, index);
>     }
>
>     public void updateColumn(UIData table, int index) {
>         Ajax.updateColumn(table, index);
>     }
> }
>
>
> On Sep 5, 2014 2:35 AM, "Karl Kildén" <ka...@gmail.com> wrote:
>
> > Hi Howard,
> >
> > Well they use custom ajax so not sure it would be very easy to understand
> > but eventually I will look at it yes :-) Still interested in hearing some
> > pro input from myfaces guys first
> >
> > Can you link me the feature in omnifaces? I cannot find it. Regarding
> > primefaces I don't want to be to dependent on frameworks as hinted in my
> > first email.
> >
> >
> > On 5 September 2014 00:33, Howard W. Smith, Jr. <sm...@gmail.com>
> > wrote:
> >
> > > Karl, you could look at PrimeFaces requestContext implementation
> (source
> > > code).
> > >
> > > also, you can maybe ask for something like this to be added as a
> feature
> > > request in MYFACES JIRA.
> > >
> > > Is there any reason why you prefer not to use PrimeFaces requestContext
> > or
> > > the similar feature that is available in OmniFaces library?
> > >
> > >
> > >
> > > On Thu, Sep 4, 2014 at 4:30 PM, Karl Kildén <ka...@gmail.com>
> > wrote:
> > >
> > > > Primefaces offers several ways to do client side stuff from the
> server.
> > > For
> > > > examples see here:
> > > > http://www.primefaces.org/showcase/ui/misc/requestContext.xhtml
> > > >
> > > > While I use primefaces I prefer to keep my hands out of the cookie
> jar
> > > with
> > > > stuff like this. I mean a datepicker can be replaced with a js widget
> > in
> > > 20
> > > > minutes if you use a composite component that wraps primefaces date
> > > picker.
> > > > However this stuff would be painful to replace.
> > > >
> > > > So my question is, could this be done in some way with JSF or
> > > myfaces-impl?
> > > >
> > > > cheers
> > > >
> > >
> >
>

Re: Decide what to rerender on server side?

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
http://showcase.omnifaces.org/utils/Ajax

click the AjaxBean tab in the Source code panel on the showcase page (see
below)


import org.omnifaces.util.Ajax;
@ManagedBean@RequestScopedpublic class AjaxBean {

    public void update() {
        Ajax.update("form:timestamp");
    }

    public void callback() {
        Ajax.oncomplete("alert('Hi, I am the oncomplete callback script!')");
    }

    public void argument() {
        Ajax.data("foo", "bar");
        Ajax.data("first", "one", "second", "two");
        Map<String, Object> data = new HashMap<>();
        data.put("bool", true);
        data.put("number", 1.2F);
        data.put("date", new Date());
        data.put("array", new Integer[] { 1, 2, 3, 4, 5 });
        data.put("list", Arrays.asList("one", "two", "three"));
        data.put("beans", Arrays.asList(new ExampleEntity(1L, "one"),
new ExampleEntity(2L, "two")));
        Ajax.data(data);
        Ajax.oncomplete("showData()");
    }

    public void updateRow(UIData table, int index) {
        Ajax.updateRow(table, index);
    }

    public void updateColumn(UIData table, int index) {
        Ajax.updateColumn(table, index);
    }
}


On Sep 5, 2014 2:35 AM, "Karl Kildén" <ka...@gmail.com> wrote:

> Hi Howard,
>
> Well they use custom ajax so not sure it would be very easy to understand
> but eventually I will look at it yes :-) Still interested in hearing some
> pro input from myfaces guys first
>
> Can you link me the feature in omnifaces? I cannot find it. Regarding
> primefaces I don't want to be to dependent on frameworks as hinted in my
> first email.
>
>
> On 5 September 2014 00:33, Howard W. Smith, Jr. <sm...@gmail.com>
> wrote:
>
> > Karl, you could look at PrimeFaces requestContext implementation (source
> > code).
> >
> > also, you can maybe ask for something like this to be added as a feature
> > request in MYFACES JIRA.
> >
> > Is there any reason why you prefer not to use PrimeFaces requestContext
> or
> > the similar feature that is available in OmniFaces library?
> >
> >
> >
> > On Thu, Sep 4, 2014 at 4:30 PM, Karl Kildén <ka...@gmail.com>
> wrote:
> >
> > > Primefaces offers several ways to do client side stuff from the server.
> > For
> > > examples see here:
> > > http://www.primefaces.org/showcase/ui/misc/requestContext.xhtml
> > >
> > > While I use primefaces I prefer to keep my hands out of the cookie jar
> > with
> > > stuff like this. I mean a datepicker can be replaced with a js widget
> in
> > 20
> > > minutes if you use a composite component that wraps primefaces date
> > picker.
> > > However this stuff would be painful to replace.
> > >
> > > So my question is, could this be done in some way with JSF or
> > myfaces-impl?
> > >
> > > cheers
> > >
> >
>

Re: Decide what to rerender on server side?

Posted by Karl Kildén <ka...@gmail.com>.
Hi Howard,

Well they use custom ajax so not sure it would be very easy to understand
but eventually I will look at it yes :-) Still interested in hearing some
pro input from myfaces guys first

Can you link me the feature in omnifaces? I cannot find it. Regarding
primefaces I don't want to be to dependent on frameworks as hinted in my
first email.


On 5 September 2014 00:33, Howard W. Smith, Jr. <sm...@gmail.com>
wrote:

> Karl, you could look at PrimeFaces requestContext implementation (source
> code).
>
> also, you can maybe ask for something like this to be added as a feature
> request in MYFACES JIRA.
>
> Is there any reason why you prefer not to use PrimeFaces requestContext or
> the similar feature that is available in OmniFaces library?
>
>
>
> On Thu, Sep 4, 2014 at 4:30 PM, Karl Kildén <ka...@gmail.com> wrote:
>
> > Primefaces offers several ways to do client side stuff from the server.
> For
> > examples see here:
> > http://www.primefaces.org/showcase/ui/misc/requestContext.xhtml
> >
> > While I use primefaces I prefer to keep my hands out of the cookie jar
> with
> > stuff like this. I mean a datepicker can be replaced with a js widget in
> 20
> > minutes if you use a composite component that wraps primefaces date
> picker.
> > However this stuff would be painful to replace.
> >
> > So my question is, could this be done in some way with JSF or
> myfaces-impl?
> >
> > cheers
> >
>

Re: Decide what to rerender on server side?

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
Karl, you could look at PrimeFaces requestContext implementation (source
code).

also, you can maybe ask for something like this to be added as a feature
request in MYFACES JIRA.

Is there any reason why you prefer not to use PrimeFaces requestContext or
the similar feature that is available in OmniFaces library?



On Thu, Sep 4, 2014 at 4:30 PM, Karl Kildén <ka...@gmail.com> wrote:

> Primefaces offers several ways to do client side stuff from the server. For
> examples see here:
> http://www.primefaces.org/showcase/ui/misc/requestContext.xhtml
>
> While I use primefaces I prefer to keep my hands out of the cookie jar with
> stuff like this. I mean a datepicker can be replaced with a js widget in 20
> minutes if you use a composite component that wraps primefaces date picker.
> However this stuff would be painful to replace.
>
> So my question is, could this be done in some way with JSF or myfaces-impl?
>
> cheers
>