The onsubmit is adding a friend to XCP. An Ajax call decorator is then
displaying a message on the client side... so the page doesnt change.  Here
is the link:

AjaxLink addFriend = new AjaxLink("addFriend")
                {
                        @Override
                        protected boolean getStatelessHint() 
                        {
                                return true;
                        }

                        private static final long serialVersionUID = 1L;

                        public void onClick(AjaxRequestTarget request)
                        {
                                makeFriends(sessionUserName, profileUserName);
                        }

                        protected IAjaxCallDecorator getAjaxCallDecorator()
                        {
                                return new AjaxCallDecorator()
                                {

                                        private static final long 
serialVersionUID = 1L;

                                        @Override
                                        public CharSequence 
decorateScript(CharSequence script)

                                        {
                                                return 
super.decorateScript(script);
                                        }

                                        @Override
                                        public CharSequence 
decorateOnSuccessScript(CharSequence script)
                                        {
                                                script = getSuccess() + script;
                                                return 
super.decorateScript(script);
                                        }

                                        @Override
                                        public CharSequence 
decorateOnFailureScript(CharSequence script)
                                        {
                                                script = getFailure() + script;
                                                return 
super.decorateScript(script);
                                        }

                                        private String getSuccess()
                                        {
                                                return "friended('addFriend','A 
friendship request was sent.');";
                                        }

                                        private String getFailure()
                                        {
                                                return "friendingFailed('Sorry, 
we were unable to send your friendship
request.  Please try again later.');";
                                        }
                                };
                        };
                };

Johan Compagner wrote:
> 
> but my question remains, what are you doing inside that ajax link??
> 
> On Nov 9, 2007 1:17 AM, Chris Lintz <[EMAIL PROTECTED]> wrote:
> 
>>
>> Ok that makes sense.  To me i can chalk this up as one thing in the
>> framework
>> that would be a real joy to fix - that being having AjaxLink or other
>> related Ajax components stateless.  I think its a real down fall that
>> sessions are created (and hence Page store cache files) for an Ajax link.
>>
>> On a really high traffic site that uses clustered session replication,
>> there
>> are affects on the back end from generating all of these sessions just
>> for
>> a
>> link.  Part of my current tasks are trying to minimize session creation.
>>
>>
>>
>>
>>
>> Johan Compagner wrote:
>> >
>> > no because the ajax behaviors are also not stateless.
>> > So even if you make the link stateless then the behaviors it has make
>> them
>> > statefull again.
>> >
>> > Sometimes ajax things can be stateless but i still think it is a bit
>> > strange
>> > for 90% or more of the cases
>> > Why is the link an ajax link?. Because in my eyes if you use ajax you
>> > still
>> > use the old page
>> > and the ajax call just updates parts of the page. But if you do that.
>> Then
>> > ajax can't be that easy
>> > stateless because how are you going to make exactly the same state as
>> the
>> > client sees in the browser
>> > for the next click?
>> >
>> > And ajax clicks should be lean and mean in my eyes because they should
>> be
>> > fast and could happen frequently
>> > and creating constantly a page for that is pretty heavy.
>> >
>> > johan
>> >
>> >
>> >
>> > On Nov 8, 2007 11:50 PM, Chris Lintz <[EMAIL PROTECTED]>
>> wrote:
>> >
>> >>
>> >> Hi.  So i have tried setting the stateless hint and my AjaxLink is
>> still
>> >> statefull.  I read some where where even Ajax components can be
>> >> stateless.
>> >> What am I missing?
>> >>
>> >> AjaxLink addFriend = new AjaxLink("addFriend")
>> >>                {
>> >>                        @Override
>> >>                        protected boolean getStatelessHint()
>> >>                        {
>> >>                                return true;
>> >>                        }
>> >>
>> >>                        private static final long serialVersionUID =
>> 1L;
>> >>
>> >>                        public void onClick(AjaxRequestTarget request)
>> >>                        {
>> >>                                makeFriends(sessionUserName,
>> >> profileUserName);
>> >>                        }
>> >> }
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Is-it-possible-to-get-AjaxLink-stateless--tf4774228.html#a13657606
>> >> Sent from the Wicket - User mailing list archive at
>> >> Nabble.com <http://nabble.com/><http://nabble.com/>
>> >> .
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Is-it-possible-to-get-AjaxLink-stateless--tf4774228.html#a13658887
>>  Sent from the Wicket - User mailing list archive at
>> Nabble.com<http://nabble.com/>
>> .
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-to-get-AjaxLink-stateless--tf4774228.html#a13669577
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to