Topic
  • No replies
maxdev1
maxdev1
1 Post

Pinned topic Dynamic scripting: best practice

‏2013-09-10T02:49:19Z |

Dear Maximo developers,

 

Please note that I am not a technical expert with recent Maximo versions and technology...I am working on a dojo object to show a frame on the Maximo webpage. The javascript is dynamic depending on the database fields. For illustration purposes only, image we need to show a picture on maximo main page and description of the image, size, quality, extension, etc in addition to the picture itself should be passed to a javascript library to drwa it executing on client side.

Question: What is the best practice here specially in modern Maximo versions with REST API:

1- Dynamically generate the javascript on server and send it to browser after loading the page using servlets in iframes? (an example is Maximo KPI using servlets in 71x to show gauges sending images in iframes). Any cross domain scripting issue here? Shall we use the same for 7.5.x ? what is the new approach?

2- Build all parameters as MIF call along with data and pass it as a call through dojo framework, get all parameters and pass it along to javascript files which would de-json it and pass it to methods drwaing that frame ?

I will give further details in order to understand the situation:

1- Method one: build a component/control. in its jsp, put an iframe which will change its "src" after loading to a servlet. That servlet will build the necessary javascript and pass it to the client which will rebuild its contents. (advantage is better control on javascript code generating and less work)

2- Method two: rely on MIF calls returning the parameters and data. The MIF is called through javascript code after being loaded. de-compose the json (or whatever) format collecting necessary details for the javascript (maybe an advantage is independency of Maximo framework.. just get data and leave the rest on javascript but this leaves the code open from licensing point of view with other third parties). 

 

The decision is mainly depending on what is the new best practice. Also, I wouldn't worry about repetitive javascript code sent to browser in method one as it is minimal calling methods to draw the frame only....

 

 

Awaiting your valuable input and thank you for comments.

 

Updated on 2013-09-10T02:57:34Z at 2013-09-10T02:57:34Z by maxdev1