I developed in .NET/javascript, so u can't use code (and my boss doesn't let me to give, also if it few lines of code...). However idea is that u could collect relevant values from user interface (the web page) which u need to build a new map (for example the list of layers, the current map extent which is returned by mapserver itself in the [mapextent] template variable, ecc...) and build a correct request for mapserver.
<br>The list of layers and other key elements for the request, u take via JavaScript with (for example):<br><br>var layersString = getLayers(); //this call a function which cicle on the layers list and takes only those the user want.
<br>imgext = document.getElementById(&quot;imgext&quot;).value; <br>imgbox = document.getElementById(&quot;imgbox&quot;).value; //setted by dbox/jbox<br>imgxy = document.getElementById(&quot;imgxy&quot;).value;&nbsp;&nbsp; //setted by dbox/jbox
<br><br>Than u build request for Mapserver, for example:<br>
<br>
<a href="http://localhost/Scripts/mapserv.exe?map=D:/Web/Heidi_Service/HGis/trentino.map&amp;layer=DTM&amp;layer=ECW&amp;imgext=1600000.1">http://localhost/Scripts/mapserv.exe?map=D:/Web/Heidi_Service/HGis/trentino.map&amp;layer=DTM&amp;layer=ECW&amp;imgext=1600000.1
</a> 5000123.4 1620003.7 5010567.9&amp;imgbox=143 200 200 255&amp;imgxy=143 200&amp;mode=browse<br><br>This request u need to pass mapserver cgi without doing a POST, otherwise u have a page reload. For doing this, I have used an Ajax library which, without doing a POST, let me to call a server side (.NET) function&nbsp; from a client side function (JavaScript).
<br>So then I do (I&#39;m still in JavaScript) a call like:<br><br>AjaxMethods.getMap(queryString, retrieveMapImage_callback);<br><br>This JavaScript function, &quot;invoke&quot; a server side function (with the same signature, but without the  retrieveMapImage_callback parameter). Details about how the Javascript function invoke the server side function are managed by the ajax library I used (and if u use other libraries, things will be different), important thing is that there is no page reload in this process.
<br><br>When the result of the server side&nbsp; function, come back to JavaScript, the retrieveMapImage_callback function is invoked. What I do in this function ? It update map elements:<br><br>document.getElementById(&quot;mapwidth&quot;).value = 
res.value.mapwidth;<br>document.getElementById(&quot;mapheight&quot;).value = res.value.mapheight;<br>document.getElementById(&quot;imgxy&quot;).value = res.value.imgxy;<br>document.getElementById(&quot;imgext&quot;).value = 
res.value.imgext;<br>document.getElementById(&quot;legend&quot;).innerHTML = res.value.legend;<br>document.getElementById(&quot;scale&quot;).value = res.value.scale;<br>imgMap.src = res.value.mapImgUrl; <br>imgRef.src = res.value.referenceMap
;<br>imgScalebar.src = res.value.scalebar;<br><br><br>But how can I have in server side, new values based on the request above ? I&nbsp; use an <br>System.Net.HttpWebRequest (this one is .NET, Java should have a similar method):
<br><br>HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(queryString);<br><br>And what&#39;s the response? In the .map file I specified to use a particular template: <br>TEMPLATE &quot;templates/web_template.xml&quot; which is:
<br><br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;<br>&lt;map&gt;<br>&nbsp;&lt;host value=&quot;[host]&quot;/&gt;<br>&nbsp;&lt;img value=&quot;[img]&quot;/&gt;<br>&nbsp;&lt;mapwidth value=&quot;[mapwidth]&quot;/&gt;
<br>&nbsp;&lt;mapheight value=&quot;[mapheight]&quot;/&gt;<br>&nbsp;&lt;scalebar value=&quot;[scalebar]&quot;/&gt;<br>&nbsp;&lt;referenceMap value=&quot;[ref]&quot;/&gt;<br>&nbsp;&lt;imgxy value=&quot;[center]&quot;/&gt;<br>&nbsp;&lt;imgext value=&quot;[mapext]&quot;/&gt;
<br>&nbsp;&lt;scale value=&quot;[scale]&quot;/&gt;<br>&nbsp;&lt;legend&gt; <br>&nbsp;&nbsp;&nbsp;&nbsp; &lt;![CDATA[<br>&nbsp;&nbsp;&nbsp;&nbsp; [legend]<br>&nbsp;&nbsp;&nbsp;&nbsp; ]]&gt;<br>&nbsp;&lt;/legend&gt;<br>&lt;/map&gt;<br><br>Normally, when u use Mapserver in cgi mode, u have the html page which contains those template parameters ( [] ). The html page do a POST, mapserver substitute parameters in the page with new values and the page is sent back to the client. 
<br>Here is different. The template is processed and remains on the server. You parse the response of the HttpWebRequest, and create an object to send to the client (the response to the Ajax call). Then the client update the page as I explained above.
<br>With Java, I think u colud use a library called DWR (Direct Web Remoting), which is conceptually similar to the AjaxPro I used (both are free). <br>Note this is only a method I used, but u could do things in different ways (u could study some php framework). Also I used MapServer in cgi mode. Maybe u want to use Java Mapscript, so things will be different.
<br><br>Ciao<br>&nbsp;Piero<br><br><div><span class="gmail_quote">2007/7/5, LITTLE Nelson &lt;<a href="mailto:nelson.little@tenix.com">nelson.little@tenix.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">










<div link="blue" vlink="blue" lang="EN-AU">

<div>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Thanks for your reply it was the only one
I got. You mentioned a lot of new technologies so I am not sure what to use. </span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Currently my web page is one big HTML
form. I was thinking that maybe when the user clicks on 'Redraw Map'
button then that button could call some JavaScript code which would update the
Map Image – but how could JavaScript do that?</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Even if I used iFrame I still need some
JavaScript to refresh the iFrame.</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Thanks,</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Nelson</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<div>

<div style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-US">

<hr align="center" size="2" width="100%">

</span></font></div>

<p><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;" lang="EN-US">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;" lang="EN-US">

Piero Cavalieri [mailto:<a href="mailto:piero.cavalieri@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">piero.cavalieri@gmail.com</a>] <br>
<b><span style="font-weight: bold;">Sent:</span></b> Wednesday, 4 July 2007 5:25
PM<br>
<b><span style="font-weight: bold;">To:</span></b> LITTLE Nelson<br>
<b><span style="font-weight: bold;">Cc:</span></b> <a href="mailto:MAPSERVER-USERS@lists.umn.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">MAPSERVER-USERS@lists.umn.edu</a><br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [UMN_MAPSERVER-USERS]
Architectural Question</span></font><span lang="EN-US"></span></p>

</div><div><span class="e" id="q_113941645e41e143_1">

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p>

<p style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">You could use iframe or
ajax ways. I used AjaxPro with.NET and cgi Mapserver and I don&#39;t have a single
page refresh (everything is updated in background: map, scalebar, legend, query
results). If u use Java, I think u coluld try DWR (Direct Web Remoting). Seems
to remember that JBox is more suitable to use with Ajax, but try some ways. <br>
<br>
Cheers<br>
&nbsp;Piero</span></font></p>

<div>

<p><span><font face="Times New Roman" size="3"><span style="font-size: 12pt;">2007/7/4, LITTLE Nelson &lt;<a href="mailto:nelson.little@tenix.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">nelson.little@tenix.com
</a>&gt;:</span></font></span></p>

<div link="blue" vlink="blue">

<div>

<div>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Hello Mapserver users,</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">I have developed a web based mapserver application using Java
Mapscript &amp; Servlets and it works well and looks great. I currently use the
Rosa Applet as the map window display. My application is very similar in
behaviour to the Mapserver Atlas application (AKA gmap) (online: <a href="http://www.mapsherpa.com/gmap/gmap75.phtml" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.mapsherpa.com/gmap/gmap75.phtml
</a>).
</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Whenever the user hits &#39;Redraw Map&#39; or clicks on a tool
button, it causes the whole pages to be refreshed. My question is how could
this be changed so that only the map window is refreshed, not the whole page? I
know this is an architectural type question which is not really related to
Mapserver, but if anyone would know the answer it would be the people on this
list.</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Thanks,</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Nelson</span></font></p>

</div>

</div>

</div>

</div>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p>

</span></div></div>

</div>


</blockquote></div><br>