I have project that I'm currently trying to customize. I'm trying to create store locator application using HTML and calling a url to output data with a XML format.
The input form I'm using accepts parameters:
<!DOCTYPE html> <html> <head> <title>Store Locator</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> </head> <body> <div align="center"> <form action="SmartHomePage2.html" method="post"> <table cellspacing="5"> <tr> <td colspan="2" align="center"> <h2>Store Locator</h2> </td> </tr> <tr> <td align="right"> Enter Your Zip Code: </td> <td> <input type="text" name="zip" value="" /> </td> </tr> <tr> <td align="right"> Enter the search radius in miles: </td> <td> <input type="text" name="dist" value="" /> </td> </tr> <tr> <td colspan="2" align="center"> <input type="submit" value="Search" /> </td> </tr> </table> </form> </div> </body> </html>
And here is what my output page looks like:
<!DOCTYPE html> <html> <head> <title>Search Results</title> </head> <body> <h1>Best Buy Results</h1> <c:import url="http://api.remix.bestbuy.com/v1/stores(area (${param.zip},${param.dist}))?show=storeId,name,distance,lat,lng &apiKey=ruuk8c4ux2p4e7d6bfftzuda" var="message" /> <x:parse var="a" doc="${message}" /> <x:forEach var="current" select="$a/stores/store"> <b> Store ID: </b> <x:out select="$current/storeId" /> <br /> <b> Name: </b> <x:out select="$current/name" /> <br /> <b> Distance: </b> <x:out select="$current/distance" /> <br /> <b> Latitude: </b> <x:out select="$current/lat" /> <br /> <b> Longitude: </b> <x:out select="$current/lng" /> <br /> </li> </ul> </x:forEach> </body> </html>
My question would be how to output XML data with HTML? Or do I need to incorporate some JavaScript?
Thank you in advance.
No comments:
Post a Comment