It's not that the JSP gets re-compiled per-user; it's the MXML that the JSP produces that gets re-compiled.  Assume that your user hits the JSP and the JSP makes some JDBC call or something to get some data.  Your JSP then writes that data in the mxml tag.  Now we see that the source to your MXML has changed (since it was newly written by the JSP) and we therefore re-compile the MXML file and then deliver it.  Now if the data is small and you only have a few users I suppose this is OK.  Or if the JDBC call is unlikely to return different results the MXML will not appear to change so we'll be able to deliver a cached version.  But if that data changes for every user, you're recompiling MXML when really the only thing that changed was your data and the compiler works pretty hard during each compilation. 

 

This is what data services like RemoteObject are for.  You get to take advantage of the MXML being ready to deliver; then you simply call the RemoteObject which will get the data for you.

 

HTH,

 

Matt

 

-----Original Message-----
From: J. Matthew Pryor [mailto:[EMAIL PROTECTED]
Sent: Monday, May 10, 2004 3:56 PM
To: [email protected]
Subject: RE: [flexcoders] Possible to use Flex/Flash components Server-sid e?

 

can you expand on this reason a little. It struck me that the JSP integration was especially useful in this regard.

 

Why would the JSP get recompiled per user?

 

Thanks,

Matthew

 


From: Matt Chotin [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 11, 2004 6:24 AM
To: '[email protected]'
Subject: RE: [flexcoders] Possible to use Flex/Flash components Server-sid e?

Note that we don't recommend having a JSP build up your data into a SWF unless it won't change very often as the re-compilation per-user is very expensive.

 

Matt

 

-----Original Message-----
From: Dan Schaffer [mailto:[EMAIL PROTECTED]
Sent: Monday, May 10, 2004 1:20 PM
To: '[email protected]'
Subject: RE: [flexcoders] Possible to use Flex/Flash components Server-sid e?

 

Tracy,

 

Another idea is to do server side processing in a jsp page using the mxml tag library.  The jsp source can use the mxml tag library and generate mxml code dynamically in java.  Using this approach your java code can access your back end resources do complex calculations/analysis and build the data directly into mxml code.  The tag library builds the generated mxml code into a swf and returns it to the client.  A jsp request has to return a full swf instead of a component.  It's an interesting idea to think about a jsp returning a component instead of an mx:Application.

 

So the client might request:   processReport.jsp?queryParam=param1&queryParam2=param2  (or pass parameters as POST)

 

The jsp may have code like:

 

processReport.jsp:

<%@ taglib uri="FlexTagLib" prefix="mm" %>

<mm:mxml>

    <mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml>

        <mx:Array id="dp0">

          <%= buildTableData() %>

       </mx:Array>

       <mx:DataGrid dataProvider="{dp0}" />

    </mx:Application>

</mm:mxml>

 

 

So your buildTableData method is just a  java method which processes the data on the server in java then returns a string with the format of  <mx:Object param1="name1" param2="name2" /> for each datagrid row.  So client downloads the processed data and does not have do the work on the client (and in actionscript).

 

Or instead of generating object data as a dataprovider from java methods you could generate normal mxml tags populated with the data.

 

Also when building some applications I have written java http services which call web services and process the data instead of making the client do additional calculations.

 

Dan

 

-----Original Message-----
From: Tracy Spratt [mailto:[EMAIL PROTECTED]
Sent: Monday, May 10, 2004 3:04 PM
To: [email protected]
Subject: RE: [flexcoders] Possible to use Flex/Flash components Server-sid e?

 

Thanks,

Since duplicating my AS logic in another language is not practical, I will just have to pull everything down to the client for my batch operations.

 

I'm not completely giving up on this idea, though.  Maybe a server-side piece could impersonate a client and access the flex on a second server....

 

Thanks, guys.

Tracy

 


From: Elliot Winard [mailto:[EMAIL PROTECTED]
Sent: Monday, May 10, 2004 2:11 PM
To: '[email protected]'
Subject: RE: [flexcoders] Possible to use Flex/Flash components Server-sid e?

 

Of course, your components would then have to be implemented as Java rather than ActionScript.

-e

 

-----Original Message-----
From: Matt Chotin [mailto:[EMAIL PROTECTED]
Sent: Monday, May 10, 2004 11:06 AM
To: '[email protected]'
Subject: RE: [flexcoders] Possible to use Flex/Flash components Server-sid e?

 

No, Flex components aren't meant to be run on the server.  This sounds like you might have a use-case for writing true server-side logic that you would then call via RemoteObject (or WebServices).

 

Matt

 

-----Original Message-----
From: nts333rd [mailto:[EMAIL PROTECTED]
Sent: Monday, May 10, 2004 8:11 AM
To: [email protected]
Subject: [flexcoders] Possible to use Flex/Flash components Server-side?

 

Say I have very complex, faceless mxml components (that do data
service access, validation, caluclation, analysis, etc) that usually
are accessed via a flex UI in the normal fashion.

But sometimes, I want to change the data underneath several of them,
initiate the processing, and simply return single values to some
master administration UI.

Is it possible to programatically instantiate an initialize flex
components a the (some?) server, and return only the single value?

Sort of making flex components work like a web service or Java
servlet themselves? And accessing via remoting or some such?

This would be for an intranet-type application, so server load would
be manageable.

Any ideas? Directed rtfm?

TIA!
Tracy Spratt

 

 

 

 

 



Reply via email to