Session timeouts can be easily handled with custom HTTP response headers.
I've an old post about this on my blog:
http://www.samaxes.com/2008/10/stripes-and-jquery-ajax-forms-and-http-session-validation/
.
Cheers,
--
Samuel Santos
http://www.samaxes.com/
On Mon, Oct 11, 2010 at 7:17 PM, Mike McNally <[email protected]> wrote:
> Actually what I do in such eventualities (example: a form with a "file"
> input that has to post to an iframe) is drop the Stripes errors tag in a div
> with a particular "id" value (or "class"; whatever), and then check in some
> Javascript code for the that element and transfer its contents to wherever I
> need it.
>
> (Of course that's not an XMLHttpRequest example, but the same trick works.)
>
>
> On Mon, Oct 11, 2010 at 12:54 PM, Newman, John W <
> [email protected]> wrote:
>
>> Sure, I guess I should have said it depends.
>>
>>
>>
>> If your stripes-errors tag and all potentially errored form fields are
>> within the updating div, it works great. But if your stripes-errors tag is
>> outside of the updating div, it won’t be updated with the new error
>> messages. *You have to catch that and issue a separate html update. And if
>> any fields are now in error outside of the div, you have to add the error
>> css yourself. In the applications I’ve written this is a common headache.
>>
>>
>>
>> And yes, if you get a 400 or 500 error you’ll need to handle that within
>> the javascript as well. Have fun with session timeouts. =) That’s all
>> expected, I just think stripes could do more with regards to ajax requests
>> and validation errors (that don’t already get rendered through the forward
>> resolution itself).
>>
>>
>>
>> *From:* Mike McNally [mailto:[email protected]]
>> *Sent:* Monday, October 11, 2010 1:34 PM
>>
>> *To:* Stripes Users List
>> *Subject:* Re: [Stripes-users] How to get JSP output as a HTML stream for
>> AJAX?
>>
>>
>>
>> If the handler returns validation errors, the JSP can just include them
>> into the response just like it would with an ordinary form post response.
>>
>>
>>
>> Now, if there's an exception of some sort, then yes the client-side code
>> would have to detect that.
>>
>> On Mon, Oct 11, 2010 at 12:30 PM, Newman, John W <
>> [email protected]> wrote:
>>
>> Yes this is actually one thing that is very easy to do. Just have an ajax
>> updater function make a request to one of your event handler methods, and
>> return a forward resolution to your jsp. The jsp will surprisingly just get
>> processed and inserted into your div. =)
>>
>>
>>
>> Now if your event handler returns validation errors, that does not work at
>> all, and you have to write a bunch of code to make it work. Stripes really
>> should do much better at that.
>>
>>
>>
>> *From:* Mike McNally [mailto:[email protected]]
>> *Sent:* Monday, October 11, 2010 1:19 PM
>> *To:* Stripes Users List
>> *Subject:* Re: [Stripes-users] How to get JSP output as a HTML stream for
>> AJAX?
>>
>>
>>
>> That's quite possible, and extremely common. The server-side (Stripes)
>> code really doesn't need to know that it's responding to an AJAX request; it
>> just forwards to the JSP as usual. The client-side code just does exactly
>> what you describe with the new content.
>>
>>
>>
>> Using a client-side framework (Dojo, Prototype, jQuery, whatever) makes
>> this considerably easier.
>>
>>
>>
>> On Mon, Oct 11, 2010 at 12:12 PM, derrickaw <[email protected]>
>> wrote:
>>
>>
>>
>> I hope I'm not asking a dumb question or one that's been answered a
>> hundred
>> times, I probably don't know the right search terms, but if anyone has any
>> pointers to answer my question it is gratefully accepted! I've been
>> happily
>> using Stripes for the past few months, but I'm not sure if this is
>> strictly
>> a Stripes question.
>>
>> I am wondering if it's possible to render a JSP from within Javascript,
>> such
>> as sending a request to the server and getting the rendered HTML stream
>> back, which I can dynamically display.
>>
>> Here's how my current web page is set up:
>>
>> <div id="customer"><jsp:include page="/customer_info.jsp" /></div>
>> <div id="specs"><jsp:include page="/widget_specifications.jsp" /></div>
>> <div id="disclaim" ><jsp:include page="/boring_legal_disclaimer.jsp"
>> /></div>
>> <div id="order"><jsp:include page="/complicated_order_form.jsp" /></div>
>>
>>
>> Changing one of these JSP files sometimes makes it necessary to change the
>> information on another JSP. I am doing an Ajax submit of the Stripes form,
>> which updates the database with no problem. However, the user display
>> isn't
>> up to date.
>>
>> I could do this easily with a servlet, getting all the HTML myself, but
>> bleh, all the JSPs are already written and they all work great. The JSPs
>> are
>> fairly complex so it's not really feasible to write some Javascript to do
>> the updates without pretty much duplicating the entire JSP code in
>> Javascript.
>>
>> So can I do this:
>>
>> 1) User updates their personal information in "customer_info.jsp",
>> database
>> updates (this step works A+)
>> 2) Ajax Call: request "complicated_order_form.jsp" rendered into HTML,
>> with
>> new db values
>> 3) Dynamically put the received HTML into the innerHTML() of the "order"
>> div
>>
>> Again, apologies if this has been answered a million times, I tried to do
>> my
>> homework, honest! On the other hand, if what I'm trying to do with the
>> JSPs
>> is simply impossible, what other strategies might be better?
>>
>> Thanks!
>>
>> -Derrick
>>
>> --
>> View this message in context:
>> http://old.nabble.com/How-to-get-JSP-output-as-a-HTML-stream-for-AJAX--tp29935584p29935584.html
>> Sent from the stripes-users mailing list archive at Nabble.com.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Beautiful is writing same markup. Internet Explorer 9 supports
>> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
>> Spend less time writing and rewriting code and more time creating great
>> experiences on the web. Be a part of the beta today.
>> http://p.sf.net/sfu/beautyoftheweb
>> _______________________________________________
>> Stripes-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>
>>
>>
>>
>> --
>> Turtle, turtle, on the ground,
>> Pink and shiny, turn around.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Beautiful is writing same markup. Internet Explorer 9 supports
>> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
>> Spend less time writing and rewriting code and more time creating great
>> experiences on the web. Be a part of the beta today.
>> http://p.sf.net/sfu/beautyoftheweb
>> _______________________________________________
>> Stripes-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>
>>
>>
>>
>> --
>> Turtle, turtle, on the ground,
>> Pink and shiny, turn around.
>>
>>
>> ------------------------------------------------------------------------------
>> Beautiful is writing same markup. Internet Explorer 9 supports
>> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
>> Spend less time writing and rewriting code and more time creating great
>> experiences on the web. Be a part of the beta today.
>> http://p.sf.net/sfu/beautyoftheweb
>> _______________________________________________
>> Stripes-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>
>>
>
>
> --
> Turtle, turtle, on the ground,
> Pink and shiny, turn around.
>
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
> Spend less time writing and rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users