Some SJS - POW Oddness

From PlainOldWebserver

Jump to: navigation, search

In porting my Sqlite Database Manager http://www.scottwickham.com/sqlitedm/ to the POW/SJS environment I have noticed a few odd things, beyond the bug of it not working in Windows.

I believe a lot of the odd behavior I have run into is because the POW webserver is NOT stateless. So if you set a variable on another page request it may still be set to the same variable unless you actively rewrite it on the new page load.

Needless to say this changes a fundamental property on the internet. I may be able to leverage for more powerful application the future..


Test Examples of the non stateless nature of POW.

Save as one.sjs

<?sjs

num = "one";

alert(num);
?>

<html>
<body>
<a href="two.sjs">two.sjs</a>
</body>
</html>

Save as two.sjs

<?sjs

num = "one";

alert(num);
?>

You will see that page two is able to get the variable written by page one. So the POW is not stateless. I am not sure if this is a bug or a feature. I will require some thought. But it will give you some strange results as you are developing applications.

Additional Examples:

These example 3.sjs

<html>
<body>
<a href="4.sjs">4.sjs</a>
</body>
</html>
<?sjs
var  yyy = "four Why ?";
alert(yyy);
?>

4.sjs

<html>
<body>
this is 4.sjs   
</body>
</html>
<?sjs
alert(yyy);
?>

This example returns Error: /pow/htdocs/session/4.sjs:14 yyy is not defined

So use var to keep your variables local to one web page.

Personal tools
Navigation