PDA

View Full Version : SpringXT : JSP based component ?



ndeloof
Oct 5th, 2006, 07:07 AM
Hello,

I'm just starting looking at SpringXT. From documentation samples it seems I have to build the HTML replacement code using Components that map my HTML structure. Is there any way to use a JSP to build this HTML ?

In some case it may be simplier to write a JSP file to produce (x)HTML than building a DOM model based on java classes. If I want to build a tableBody content, It is easy in JSP to use a <c:foreach> inside a table canvas, but this requires lot's of code to add TableRow / TableDatas and then my formated content.

Is there any support for this, or plan for such a use case ?

Another use case I'd like to use is to return Javascript code. I'm using openRico Effects to create a nice transition between my two phase transaction (some blocks fade, some other reduces, and a confirm box appears). I'd like this JavaScript code to be in a separate JS file. Can I use SpringXT to replace some fake DIV content with my JS content and eval it ? (I can do this using Prototype Ajax.Updater).

A third use case is a combination of those two : my JSP code could be created from a JSP, so that some content can be dynamically created.

Can I expect such features in springXT ?

sbtourist
Oct 5th, 2006, 08:12 AM
Hi,

thanks for your interest in XT Ajax Framework.

> Is there any way to use a JSP to build this HTML ?

There's a Jira issue about that:
http://opensource.atlassian.com/projects/spring/browse/MOD-212
It is planned for the next release.

> Another use case I'd like to use is to return Javascript code. I'm using
> openRico
> Effects to create a nice transition between my two phase transaction (some
> blocks fade, some other reduces, and a confirm box appears). I'd like this
> JavaScript code to be in a separate JS file.

I'm working for building a complete effects solution based on Prototype/Scriptaculous.
However, you are able to use your preferred Ajax suite: just use the ExecuteJavascriptFunctionAction action (https://springmodules.dev.java.net/source/browse/*checkout*/springmodules/www/docs/javadocs/0.6/org/springmodules/xt/ajax/action/ExecuteJavascriptFunctionAction.html ).
It will let you call a JS function placed in a client side script (take a look at its javadoc).
If you need something different, you can always create a Jira issue ;)

> A third use case is a combination of those two : my JSP code could be
> created from a JSP, so that some content can be dynamically created.

It is not clear what you mean: can you explain better?

Cheers,

Sergio B.

ndeloof
Oct 5th, 2006, 08:27 AM
If I understand the Javadoc, ExecuteJavascriptFunctionAction is designed to execute a JS function that is allready define in the browser HTML. I'd like to include the function definition/body in the Ajax response, so that I can create a separated JS file for any "transition", without having a huge myApp.js with all possible effects that my page includes.

If I want to build an Ajax application "in a single HTML page", I'll need lot's of such transition and I don't want my page to include a huge "mayApp.js" with code for all possible effects.

I also would like the JS function code to be created on the fly from a JSP, so that some parts can be dynamically generated, according to user state or any contextual data.

sbtourist
Oct 5th, 2006, 08:38 AM
If I understand the Javadoc, ExecuteJavascriptFunctionAction is designed to execute a JS function that is allready define in the browser HTML.


Yes, you are right.



I'd like to include the function definition/body in the Ajax response, so that I can create a separated JS file for any "transition", without having a huge myApp.js with all possible effects that my page includes.


So, if I understand, you want to include in the Ajax response a function definition read *by server side* from a JS file, and then execute it *by client side* ... am I right?



I also would like the JS function code to be created on the fly from a JSP, so that some parts can be dynamically generated, according to user state or any contextual data.

I understand.

Such a features are not planned at the moment.
If you are interested, can you create two different Jira issues?
Once created, I'll evaluate if include them for the next release.

Thanks,
Cheers,

Sergio B.

ndeloof
Oct 5th, 2006, 09:55 AM
MOD-231 & MOD-232 created.



Thanks !