Question

I have been in web programming for 2 years (Self taught - a biology researcher by profession). I designed a small wiki with needed functionalities and a scientific RTE - ofcourse lot is expected. I used mootools framework and AJAX extensively.

I was always curious when ever I saw the query strings passed from URL. Long encrypted query string directly getting passed to the server. Especially Google's design is such. I think this is the start of providing a Web Service to a client - I guess.

Now, my question is : is this a special, highly professional, efficient / advanced web design technique to communicate queries via the URL ?

I always felt that direct URL based communication is faster. I tried my bit and could send a query through the URL directly. here is the link: http://sgwiki.sdsc.edu/getSGMPage.php?8 By this , the client can directly link to the desired page instead of searching and / or can automate. There are many possibilities.

The next request: Can I be pointed to such technique of web programming? oops: I am sorry, If I have not been able to convey my request clearly.

Prasad.

Was it helpful?

Solution

I think this is the start of providing a Web Service to a client - I guess.

No not really, although it can be. Its used to have a central entry point to the entire application. Its a common practice and has all kinds of benefits, but its obviously not required. Often thes days though even a normal url you see may not actual be a physical page in the application.. each part of the path may actuall be mapped to a variable through rewriting and routing on the server side. For example the URL of this question:

http://stackoverflow.com/questions/2557535/general-web-programming-designing-question

Might map to something like

http://stackoverflow.com/index.php?module=questions&action=view&question=2557535&title=general-web-programming-designing-question

is this a special, highly professional, efficient / advanced web design technique to communicate queries via the URL ?

Having a centralized page through which all functions within an application are accessed is part of the Front Controller Pattern - a common pattern in applications generally used as part of the overall Model, View, Controller (MVC) pattern. In MVC, the concerns of the application are divided into the model which holds the business logic. These models are then used by the controller to perform a set of tasks which can produce output. This output is then rendered to the client (browser, window manager, etc..) via the view layer.

OTHER TIPS

I think that essentially what you are asking about is query strings. In a url after a page, there may be a question mark after which, there may be URL parameters (generally called GET request parameters.)

http://www.google.com/search?q=URL+parameter

Generally, processing this would be done on the server-side. For example, in PHP, one could use the following:

$_GET['q']

The aforementioned code would be the value of the variable. Alternatively, to do this client-side, one could use anchors. Replace the question mark with a hash sign #

Since this is used for anchors, when a URL is changed to have an anchor tag, the page is not refreshed. This allows for a completely AJAX-driven page to manipulate the URL without refreshing. This method is often used also for enabling back-button support for AJAX pages.

In JavaScript, one can use the onload handler as an opportunity to read the URL of the page and get the hash part of the URL. The page could then make a request back to the server to read any neccessary data.

It's a consequence of using a front controller architecture. This fits neatly with the idea of a wiki where the same code is used to render multiple different wiki pages - the content is defined by the data.

Using the query part of the URL for the page selection criteria is not the only solution. e.g. if you are using apache then you could implement:

http://sgwiki.sdsc.edu/getSGMPage.php?8

as

http://sgwiki.sdsc.edu/getSGMPage.php/8

(you'll need to add your own parsing to get the value out.

Alternatively, you can use mod_rewrite to map components out of the path back into the query.

There's no particular functional/performance reason for adopting any of these strategies. Although it is recommended, where the URL is idempotent, that each page be addressable via a GET operation (also useful for SEO).

C.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top