473,773 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

If you had JavaScript running server-side...?

I'm writing a server-side web application framework using Mozilla's
Rhino JavaScript engine. My two primary motivations are so I can write
code on server and client sides without needing to switch gears
mentally and so that the server and client can share code.

The types of code sharing I know I can use immediately are form
validations and html previews. For form validation, I'll be able to
specify the regexp for what is an email address in just one language
rather than in both Perl|Python|Rub y|Java|etc and in JavaScript. For
something like a blog comment form or a wiki editor, where the user
can use *bold* or _underline_ syntax, the algorithm to convert this
code to HTML will only need to be expressed in one language. This
makes live previews in the editor much easier to implement.

I'm curious what other bits of common (or uncommon) client-side
functionality that you would be able to share with the server if you
had server-side framework running JavaScript.

Thanks,
Peter
Jan 19 '08 #1
12 1733
On Jan 19, 3:11 pm, Peter Michaux <petermich...@g mail.comwrote:
I'm writing a server-side web application framework using Mozilla's
Rhino JavaScript engine. My two primary motivations are so I can write
code on server and client sides without needing to switch gears
mentally and so that the server and client can share code.

The types of code sharing I know I can use immediately are form
validations and html previews. For form validation, I'll be able to
specify the regexp for what is an email address in just one language
rather than in both Perl|Python|Rub y|Java|etc and in JavaScript. For
something like a blog comment form or a wiki editor, where the user
can use *bold* or _underline_ syntax, the algorithm to convert this
code to HTML will only need to be expressed in one language. This
makes live previews in the editor much easier to implement.

I'm curious what other bits of common (or uncommon) client-side
functionality that you would be able to share with the server if you
had server-side framework running JavaScript.

Thanks,
Peter
I've recreated the Prototype 1.6.0 Library on the server side. Just
go through the script and pull out references to DOM objects. This
will give you basic OOP functionality. You may also want to look at
Base2 or ExtJS for there implementations of inheritance.

Utilizing the prototype.toStr ing method comes in really handy when
designing widgets.
function Tree(){
this.branches = [];
};
Tree.prototype = {
read: function(sql){
// run ado query
// populate tree with branches
},
addBranch: function(branch ){
this.branches.p ush(branch);
branch.parent = this;
},
toString: function(){
var html = [];
this.branches.e ach(function(br anch){
html.push(branc h);
}
return "<ul>" + html.join("") + "</ul>";
}
}

var itemTree = new Tree();
itemTree.read(s qlString);

Response.Write( itemTree);

You can already do this within ASP, just change your language
declaration to "Javascript ".

I'm also creating an ASP Framework. It's a port of Fusebox (from the
ColdFusion community) written in JScript, but it will work with either
JScript or VBScript applications.

Jan 20 '08 #2
st**********@gm ail.com wrote:
On Jan 19, 3:11 pm, Peter Michaux <petermich...@g mail.comwrote:
>[...]
I'm curious what other bits of common (or uncommon) client-side
functionalit y that you would be able to share with the server if you
had server-side framework running JavaScript.
[...]

I've recreated the Prototype 1.6.0 Library on the server side. [...]
See <news:47******* *****@PointedEa rs.de>
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Jan 20 '08 #3
Thomas 'PointedEars' Lahn said the following on 1/20/2008 6:49 AM:
st**********@gm ail.com wrote:
>On Jan 19, 3:11 pm, Peter Michaux <petermich...@g mail.comwrote:
>>[...]
I'm curious what other bits of common (or uncommon) client-side
functionali ty that you would be able to share with the server if you
had server-side framework running JavaScript.
[...]
I've recreated the Prototype 1.6.0 Library on the server side. [...]

See <news:47******* *****@PointedEa rs.de>
That's nice[1].

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 20 '08 #4
On Jan 20, 10:14 am, Randy Webb <HikksNotAtH... @aol.comwrote:
Thomas 'PointedEars' Lahn said the following on 1/20/2008 6:49 AM:
stevenmob...@gm ail.com wrote:
On Jan 19, 3:11 pm, Peter Michaux <petermich...@g mail.comwrote:
[...]
I'm curious what other bits of common (or uncommon) client-side
functionalit y that you would be able to share with the server if you
had server-side framework running JavaScript.
[...]
I've recreated the Prototype 1.6.0 Library on the server side. [...]
See <news:47******* *****@PointedEa rs.de>

That's nice[1].
You disagree with Thomas' sentiment or is it the odd way he linked it?

Just in case anyone has problems with Thomas' link style...

<URL: http://groups.google.c om/group/comp.lang.javas cript/msg/76e2debc87edaf1 0>

Peter
Jan 20 '08 #5
Peter Michaux wrote on 20 jan 2008 in comp.lang.javas cript:
On Jan 20, 10:14 am, Randy Webb <HikksNotAtH... @aol.comwrote:
>Thomas 'PointedEars' Lahn said the following on 1/20/2008 6:49 AM:
stevenmob...@gm ail.com wrote:
On Jan 19, 3:11 pm, Peter Michaux <petermich...@g mail.comwrote:
[...]
I'm curious what other bits of common (or uncommon) client-side
functionali ty that you would be able to share with the server if
you had server-side framework running JavaScript.
[...]
I've recreated the Prototype 1.6.0 Library on the server side.
[...]
See <news:47******* *****@PointedEa rs.de>

That's nice[1].

You disagree with Thomas' sentiment or is it the odd way he linked it?
It is not an odd way to link a News Article, but the standard way.

My and most other mail readers support it.
Just in case anyone has problems with Thomas' link style...

<URL:
http://groups.google.com/group/comp....6e2debc87edaf1
0>
That is not the link to the News article,
but [perhaps, not tested] to the archived version of it.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 20 '08 #6
Peter Michaux said the following on 1/20/2008 1:53 PM:
On Jan 20, 10:14 am, Randy Webb <HikksNotAtH... @aol.comwrote:
>Thomas 'PointedEars' Lahn said the following on 1/20/2008 6:49 AM:
>>stevenmob...@ gmail.com wrote:
On Jan 19, 3:11 pm, Peter Michaux <petermich...@g mail.comwrote:
[...]
I'm curious what other bits of common (or uncommon) client-side
functionali ty that you would be able to share with the server if you
had server-side framework running JavaScript.
[...]
I've recreated the Prototype 1.6.0 Library on the server side. [...]
See <news:47******* *****@PointedEa rs.de>
That's nice[1].

You disagree with Thomas' sentiment or is it the odd way he linked it?
I have explained to Thomas, many times, with the flaws in that style link.

Perhaps someone can tell me how to get Thunderbird to honor that link?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 20 '08 #7
Peter Michaux wrote:
On Jan 20, 10:14 am, Randy Webb <HikksNotAtH... @aol.comwrote:
>Thomas 'PointedEars' Lahn said the following on 1/20/2008 6:49 AM:
>>stevenmob...@ gmail.com wrote:
On Jan 19, 3:11 pm, Peter Michaux <petermich...@g mail.comwrote:
[...]
I'm curious what other bits of common (or uncommon) client-side
functionali ty that you would be able to share with the server if you
had server-side framework running JavaScript.
[...]
I've recreated the Prototype 1.6.0 Library on the server side. [...]
See <news:47******* *****@PointedEa rs.de>
That's nice[1].

You disagree with Thomas' sentiment
There is no sentiment that can be found there, but is an explanation why an
approach is misguided and the result of following it is ultimately bad.
or is it the odd way he linked it?
The way it is being referred to is not at all odd; it is the way that is
supported by most newsreaders, including Windows' built-in Outlook express
and Google Groups. (Just click the link that OE and GG create from it.)
Just in case anyone has problems with Thomas' link style...
It is not my link style. It is not even really a link, that is what some
newsreaders make of it. (Think of what would have happened if I had posted
a proper Message-ID header value instead ...)
<URL: http://groups.google.c om/group/comp.lang.javas cript/msg/76e2debc87edaf1 0>
It works, but it makes little sense, if any. Despite what Google Groups and
other mirrors want you to believe, Usenet is not on the Web.

http://en.wikipedia.org/wiki/Usenet
PointedEars
--
var bugRiddenCrashP ronePieceOfJunk = (
navigator.userA gent.indexOf('M SIE 5') != -1
&& navigator.userA gent.indexOf('M ac') != -1
) // Plone, register_functi on.js:16
Jan 20 '08 #8
Thomas 'PointedEars' Lahn said the following on 1/20/2008 2:24 PM:
Peter Michaux wrote:
<snip>
><URL: http://groups.google.c om/group/comp.lang.javas cript/msg/76e2debc87edaf1 0>

It works, but it makes little sense, if any. Despite what Google Groups and
other mirrors want you to believe, Usenet is not on the Web.
Nobody said Usenet is on the Web. The archives for Usenet are on the Web
though. And that is what Peter linked to was the archive of that post.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 20 '08 #9
Randy Webb wrote:
Thomas 'PointedEars' Lahn said the following on 1/20/2008 2:24 PM:
>Peter Michaux wrote:
>><URL: http://groups.google.c om/group/comp.lang.javas cript/msg/76e2debc87edaf1 0>
It works, but it makes little sense, if any. Despite what Google Groups and
other mirrors want you to believe, Usenet is not on the Web.

Nobody said Usenet is on the Web. The archives for Usenet are on the Web
though. And that is what Peter linked to was the archive of that post.
Several, but not all, Usenet archives are available via the Web. Those that
are on the Web are neither complete, nor do they always present the original
article. Google Groups in its current form makes no exception.

Furthermore, Web archives are not required to access an article that was
posted only a few days ago; there is no public news server that has such a
short expiration setting.

And if my articles eventually expire, both will only be available in the
archives, be they public or private. In fact, my (Google) research showed
that providers of public Usenet archives have been going to great lengths to
support `news:' URIs in the way I posted as being rewritten to links to
their archives.
EOD

PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Jan 20 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
32826
by: john woo | last post by:
Hi in JSP, it's easy to pass value from java-variable to javascript-variable, like js_function(a) { a=<%java-class.A%> } I'm wondering how is the other way around? I tried
2
2883
by: Kenneth | last post by:
Hi, In a document I have three lines that detects and redirects to another page is a session variable is 0 If Session("Customer_ID")=0 Then Response.Redirect("myPage.aspx") End If What I really would like to have is a notification for the
2
1996
by: Jimmy | last post by:
Hi How do you refer from you webpage to a usercontrol which contains a n html control with javascript? usercontrol contains: <input id="tb1" name="tb1" type=text>
19
1550
by: The Numerator | last post by:
I was just wondering that if it is possible to do almost anything you can do in JavaScript in PHP.
9
2420
by: Boris Yeltsin | last post by:
I use Master Pages, so I make use of URL rebasing through the ~ operator, like this in the <head>: <link runat="server" href="~/Root.master.css" media="screen" rel="stylesheet" type="text/css" /> It works perfectly and the ~ gets converted by the server into the correct relative path. Great! Now, I put this in the <head>: <script type="text/javascript" src="~/Root.master.js"
4
1273
by: Eric.Thomas.Moore | last post by:
Hey, My old boss wrote an extensive work tracking system in php for internal use. He left and the server he is running it on is very outdated so I have been given the task of transfering it over to a new server and the latest versions of php, mysql, and apache. That information is probably not relevant to the question. His system has some javascript forms. One of which is a drop down menu that uses the onchange functionality. Here...
7
7321
by: Rob | last post by:
Hi, I'm getting an error on my login page when using Javascript session object. It works on the development server so I'm wondering if there is a setting in IIS to allow using sessions on the server. When the user clicks on the submit button after entering their username and password, it calls a function (below) and I get an "Object expected" javascript error. This is the function:
6
2776
by: Venkatesh | last post by:
Hello All, I have couple of doubts regarding the concept of on-demand javascript loading using javascript code. I could see on the net different techniques for achieving this - techniques like: 1. document.write("<script src= language='JavaScript'></script>); 2. sc = document.createElement("<script>"); sc.setAttribute("src", ); and append this to the head
4
2061
by: Epictitus | last post by:
I am trying to write a script which will allow me to read the contents of an HTTP web page into memory, parse the data, and output a calculated value. The HTTP page is on a web enable appliance - I am reading some data out of a table for further calculation. I can't modify the web appliance, only read the text data. I've written a script on my Windoze PC that successful uses a MSXML2 ActiveX object to read the contents of a web page...
2
1837
by: an96su | last post by:
Hi, I'm new to php. i'm trying to send information from my php (client) script to a website that is running javascript. Here is an extract of the server's response to my initial http request. I need to know how to communicate further with the server. Thanks, anne
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.