× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Nathan,

JavaScript is just text. If the server can send HTML, it can send JavaScript.

I use IceBreak and write server code exclusively in RPG using a .asp type syntax. I would be very surprised if other Web Application servers also cannot generate the required output although using different techniques.

This is a very simplistic example of code and it uses some built in IceBreak features - but here goes. This will say 'Good morning/afternoon/evening' to the signed on user via a JavaScript alert box. It also sends an additional message if the user is working late:-

<html>
<head>
<%
D theHour S 10U 0
D txt S 50A VARYING
D late S N

/FREE
IF LoggedOn();
theHour = %SUBDT(%TIME():*HOURS);
late = (theHour >= 18);
SELECT;
WHEN theHour <= 12;
txt = ' morning ';
WHEN theHour > 12 AND theHour < 18;
txt = ' afternoon ';
OTHER;
txt = ' evening ';
ENDSL;
%>
<script type="text/javascript">
alert('Good<%=txt%><%=GetServerVar('SERVER_JOB_USER')%>');
<%
IF late;
<%alert('I hope you are getting a good overtime rate?');%>
ENDIF;
%>
</script>
<%
ELSE;
%><script type="text/javascript">alert('You have not logged on');</script><%
ENDIF;
RETURN;
/END-FREE
%>
</head>
<body>
</body>
</html>

Of course, the RPG SELECT statement could be replaced by a JavaScript if/else if construct by defining a variable and then testing it with if statements. Using this technique we can predefine the values of variables on the client using data from the server.:-

var hr = <%=%CHAR(theHour)%>;
var user = <%=GetServerVar('SERVER_JOB_USER')%>;
var txt;
if (hr <= 12) txt = ' morning ';
else if (hr > 12 && hr < 18) txt = ' afternoon ';
else txt = ' evening ';
alert('Good' + txt + user);


I hope this explains matters

Syd



----- Original Message ----- From: "Nathan Andelin" <nandelin@xxxxxxxxx>
To: "Web Enabling the AS400 / iSeries" <web400@xxxxxxxxxxxx>
Sent: Thursday, July 17, 2008 11:01 PM
Subject: Re: [WEB400] The "Presentation" Layer


From: Dr. Syd Nicholson
The JavaScript is very controllable on the server. Depending
upon the situation the server can dynamically select or create
the required JavaScript and send this to the client.

It sounds like you're saying that the server can still be in control of the application by dynamically generating and downloading JavaScript instead of HTML. While that sounds plausible in theory, can you point to an example?

The toolkits I've been looking at, download a lot of JavaScript. But it's not dynamically generated. In the case of the RSDC client that Chris Laffra built with Joe Pluta, I understand the JavaScript was generated. But that was part of the "build" process. Not part of the request-response cycle.

What I'm seeing on the horizon is more control moving to client devices. Clients generating the UI, controlling application flow, data validation, interfacing with local data stores, and synchronizing with the server at entry points, and various points thereafter.

If the JavaScript is static, it essentially eliminates the appeal of middleware on the server (asp.net, net.data, cgi, j2ee, etc.). And yet it's not quite like client-server of 80's and 90's. A lot of vested interests are being shaken.

Walden mentioned Google Gears in his last message. So I read a little
about it. It sounds like a plug-in that enables data stores to be
persisted locally. What begins as a Web application, may be taken off-line.

Nathan.



--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.


Scanned by IFB SafeMail http://www.ifb.net for spam/UCE and virus content.
IFB Spam-Score:* (1.076)




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.