Hi, in my web server application i need to have multiply html pages for ad.cgi. but i can't prediction number of sub pages so i cant't copy & paste base ad.cgi page with different names and put them on Web static file.
my prefer links is something like this :
192.168.0.10/ad.cgi?p=1 .... 192.168.0.10/ad.cgi?p=100
how i can implement this method of dynamic HTTP link ? can i process parameters on http page requests?
Your approach means, your embedded web server should make up an entire web page, specified by the URI, on its RAM.
You would better to learn JavaScript to make the contents of your web pages dynamic, instead of "Dynamic HTTP Link".
1) First, your embedded server provides a template web page and script(s) to a PC browser. 2) On the PC browser, using XMLHttpRequest, the script retrieves values/strings from your embedded server over CGI. 3) The script fills the template page with these values/strings, and show it up on the PC browser as a web page.
That is, the web page is made up on the PC browser side, by communicating with your embedded server. This approach makes your embedded server simple. Also, even an 8bit MCU with small RAM size may serve.
I wrote about this approach a little more detailed on this SiLabs topic, community.silabs.com/.../18665
Tsuneo
Thanks for your reply,
I'm using CGI + Javascript for making dynamic page content too and the entire web page for all dynamic links are same. Imagine that we have 10 adc value showing on same web page adc.cgi. For determine adc number to show we need to get adc number from user.
I think use dynamic URL is better for select adc number because we can use it in html pages and user can simply change the number in URL for change adc number.
My index HTML page have this code for simply select and show adc values: <a href="/adc.cgi?p=1">ADC 1</a> <a href="/adc.cgi?p=2">ADC 2</a> <a href="/adc.cgi?p=3">ADC 3</a> <a href="/adc.cgi?p=4">ADC 4</a>
> I think use dynamic URL is better for select adc number,
and your page design refreshes entire web page every time when the ADC value changes?
In my design, user specifies the ADC channel with Menu-select (pull-down) on a Form. The script periodically sends a query to the server for the ADC value on the channel using XMLHttpRequest. Receiving answer from the server, the script rewrites just the figure of the ADC value on the web page.
What is your criteria of "better"? Web users take no notice to your code simplicity at all. They appreciate page looks and usability.
Many thanks for the prompt reply.
Yes, page design refreshes adc value web page in every second via adc.cgx script.
My design is very similar to yours ,but in my design user specifies the adc channel in main index.html via adc channels URLs table (maybe pull-down Menu-select). After the selection of channel user is directed to adc.cgi page. For this reason, we need to tell adc.cgi page which adc channel selected in previous page. One approach is to send adc channel via URL parameter because we can't use POST method at the same time, user directed to adc.cgi.
Have you other suggestion to tell adc.cgi, which adc channel selected previously ??