473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Need helpf with javascript if else

I need to set up an if else to show different weather scripts based on
the city selection they choose. Any help on this would be great.
Thanks!
<%@ page language="java" import="java.util.*, java.text.* " %>
<%@ page import="com.plumtree.remote.portlet.*" %>
<%@ page import="com.plumtree.remote.prc.*" %>
<%
String path = request.getContextPath();
String basePath =
request.getScheme()+"://"+request.getServerName()+":"+request.getServerPor t()+path+"/";
%>
<% response.setHeader("Cache-Control", "max-age=3400"); %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>Weather</title>

<!-- <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0"> -->
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<!--
<link rel="stylesheet" type="text/css" href="styles.css">
<link rel='stylesheet'
href='pt://images/plumtree/portal/custom/fh_styles/style.css'>
-->
<body>
<table>
<tr><td>
<script>

if (city="albany")
{
open("http://voap.weather.com/weather/oap/USTX0016?template=GENXH&par=null&unit=0&key=ba8a96 0da18891295bbc4cfea6a0dbe2");

}
else if(city="amsterdam")
{
window.open("http://voap.weather.com/weather/oap/NLXX0002?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if(city="atlanta")
{

window.open("http://voap.weather.com/weather/oap/USGA0028?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='austin')
{

String("http://voap.weather.com/weather/oap/USTX0057?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='beijing')
{

String("http://voap.weather.com/weather/oap/CHXX0008?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='berlin')
{

String("http://voap.weather.com/weather/oap/GMXX0007?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='boston')
{

String("http://voap.weather.com/weather/oap/USMA0046?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='brussels')
{

String("http://voap.weather.com/weather/oap/BEXX0005?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='buffalo')
{

String("http://voap.weather.com/weather/oap/USNY0181?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='calgary')
{

String("http://voap.weather.com/weather/oap/CAXX0054?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e'")
}
else if (city='charlotte')
{

String("http://voap.weather.com/weather/oap/USNC0121?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e'")
}
else if (city='chicago')
{

String("http://voap.weather.com/weather/oap/USIL0225?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e'")
}
else if (city='cleveland')
{

String("http://voap.weather.com/weather/oap/USOH0195?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='dallas')
{

String("http://voap.weather.com/weather/oap/USTX0327?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='detroit')
{

String("http://voap.weather.com/weather/oap/USMI0229?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='dublin')
{

String("http://voap.weather.com/weather/oap/EIXX0014?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='edinburgh')
{

String("http://voap.weather.com/weather/oap/UKXX0052?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e'")
}
else if (city='edmonton')
{

String("http://voap.weather.com/weather/oap/ASXX0036?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='frankfurt')
{

String("http://voap.weather.com/weather/oap/GMXX0185?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='hongkong')
{

String("http://voap.weather.com/weather/oap/CHXX0049?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='houston')
{

String("http://voap.weather.com/weather/oap/USTX0617?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='johannesburg')
{

String("http://voap.weather.com/weather/oap/SFXX0023?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='kansascity')
{

String("http://voap.weather.com/weather/oap/USMO0460?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='kualalumpur')
{

String("http://voap.weather.com/weather/oap/MYXX0008?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='london')
{

String("http://voap.weather.com/weather/oap/UKXX0085?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='losangeles')
{

String("http://voap.weather.com/weather/oap/USCA0638?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='madrid')
{

String("http://voap.weather.com/weather/oap/SPXX0050?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='manila')
{

String("http://voap.weather.com/weather/oap/RPXX0017?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='melbourne')
{

String("http://voap.weather.com/weather/oap/ASXX0075?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='mexico')
{

String("http://voap.weather.com/weather/oap/MXDF0132?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='miami')
{

String("http://voap.weather.com/weather/oap/USFL0316?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='milan')
{

String("http://voap.weather.com/weather/oap/ITXX0042?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='minneapolis')
{

String("http://voap.weather.com/weather/oap/USMN0503?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='montreal')
{

String("http://voap.weather.com/weather/oap/CAXX0301?template=GENXH&par=null&unit=1&key=91722c 3a3c6b8b302602ce2bf13950ae")
}
else if (city='munich')
{

String("http://voap.weather.com/weather/oap/GMXX0087?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='neworleans')
{

String("http://voap.weather.com/weather/oap/USLA0338?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='newyork')
{

String("http://voap.weather.com/weather/oap/USNY0996?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='ottawa')
{

String("http://voap.weather.com/weather/oap/CAXX0343?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='paris')
{

String("http://voap.weather.com/weather/oap/FRXX0076?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='portland')
{

String("http://voap.weather.com/weather/oap/USOR0275?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='prague')
{

String("http://voap.weather.com/weather/oap/EZXX0012?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='quebec')
{

String("http://voap.weather.com/weather/oap/CAXX0385?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='raleighdurham')
{

String("http://voap.weather.com/weather/oap/USNC0558?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='sacramento')
{

String("http://voap.weather.com/weather/oap/USCA0967?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='sanantonio')
{

String("http://voap.weather.com/weather/oap/USTX1200?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='sandiego')
{

String("http://voap.weather.com/weather/oap/USCA0982?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='sanfrancisco')
{

String("http://voap.weather.com/weather/oap/USCA0987?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='sanjuan')
{

String("http://voap.weather.com/weather/oap/PEXX0047?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='seattle')
{

String("http://voap.weather.com/weather/oap/USWA0395?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='seoul')
{

String("http://voap.weather.com/weather/oap/KSXX0037?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='shanghai')
{

String("http://voap.weather.com/weather/oap/CHXX0116?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='singapore')
{

String("http://voap.weather.com/weather/oap/SNXX0006?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='StLouis')
{

String("http://voap.weather.com/weather/oap/63102?template=GENXH&par=null&unit=0&key=67d2b0264 796112ce6d75944acad734e")
}
else if (city='sydney')
{

String("http://voap.weather.com/weather/oap/ASXX0112?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='tokyo')
{

String("http://voap.weather.com/weather/oap/JAXX0085?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='toronto')
{

String("http://voap.weather.com/weather/oap/CAXX0504?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if (city='vancouver')
{

String("http://voap.weather.com/weather/oap/CAXX0518?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
else if(city='warsaw')
{

String("http://voap.weather.com/weather/oap/PLXX0028?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e")
}
</script>

</td></tr></table>
</body>

Jan 19 '06 #1
4 2281
Br**********@hotmail.com wrote in
news:11**********************@g14g2000cwa.googlegr oups.com:
I need to set up an if else to show different weather scripts based on
the city selection they choose. Any help on this would be great.
Thanks!

You sure do need help, doncha?

<%@ page language="java" import="java.util.*, java.text.* " %>
<%@ page import="com.plumtree.remote.portlet.*" %>
<%@ page import="com.plumtree.remote.prc.*" %>
<%
String path = request.getContextPath();
String basePath =
request.getScheme()+"://"+request.getServerName()+":"+request.getServe r
Port()+path+"/"; %>
<% response.setHeader("Cache-Control", "max-age=3400"); %>

The above is some sort of server-specific stuff, huh? Active server page-
type stuff?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>Weather</title>

<!-- <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0"> -->
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<!--
<link rel="stylesheet" type="text/css" href="styles.css">
<link rel='stylesheet'
href='pt://images/plumtree/portal/custom/fh_styles/style.css'>
-->
<body>
<table>
<tr><td>
<script>
Okay, you have embedded script into a one-cell table. Any reason why?
It's quite okay to have script contained in just a bare body. (Did I just
say that?)

It would be a good idea to include the script element's TYPE attribute
rather than to assume any defaults:

<script type="text/javascript">
if (city="albany")
Error: variable city undefined
Where did you assign 'city' a value prior to your use of it?

Warning: variable 'city' is assigned string constant "albany" rather than
compared to it. Condition always evaluates true.

Did you want to know if city == "albany", or did you want to make
the city have the string value "albany"?

By the way, you may run into trouble if you say, city == "albany" since
names of cities are often capitalized. If you want to be safe in comparing
strings whose case you may not know, try:

if (city.toLowerCase() == "albany")
{
open("http://voap.weather.com/weather/oap/USTX0016?template=GENXH&par=n
ull&unit=0&key=ba8a960da18891295bbc4cfea6a0dbe2");
This script line will always be executed if you use an assignment rather
than a comparison in your conditional test. That's quite a URL there. Do
you need to escape it...i.e., use the function urlEncode()??
}
else if(city="amsterdam")
Again, you'll want to correct all of these comparisons
{
window.open("http://voap.weather.com/weather/oap/NLXX0002?template=GENX
H&par=null&unit=0&key=67d2b0264796112ce6d75944acad 734e")
}
else if(city="atlanta")
{

window.open("http://voap.weather.com/weather/oap/USGA0028?template=GENX
H&par=null&unit=0&key=67d2b0264796112ce6d75944acad 734e")
}
else if (city='austin')
{

String("http://voap.weather.com/weather/oap/USTX0057?template=GENXH&par
=null&unit=0&key=67d2b0264796112ce6d75944acad734e" )
Hmmm....you create a string object and assign it to nothing. Was this
supposed to open a window as well?

Same down below.

By the way, I encourage you to end Javascript statements in semicolons,
although I know there are two sides to this issue. The heritage of
Javascript is such that its statements end in semicolons.
}
else if (city='beijing')
{

String("http://voap.weather.com/weather/oap/CHXX0008?template=GENXH&par
=null&unit=1&key=67d2b0264796112ce6d75944acad734e" )
}

You know, while that series of if-else blocks will certainly, I recommend
something more readable, at least for me.

Why not try this?

var cityWeather = [
{ cityName: "city1name",
weatherURL: "http://my.weather.url/for/city?number=1" },
{ cityName: "city2name",
weatherURL: "http://my.weather.url/for/city?number=2" },
{ cityName: "city13ame",
weatherURL: "http://my.weather.url/for/city?number=3" },
{ cityName: "city4name",
weatherURL: "http://my.weather.url/for/city?number=4" },
{ cityName: "city5name",
weatherURL: "http://my.weather.url/for/city?number=5" }
// as many 2-property objects as you have cities and weather
];

for (var i = 0; i < cityWeather.length; i++)
if (city.toLowerCase() == cityWeather[i].cityName.toLowerCase())
{
open (cityWeather[i].weatherURL);
break;
}

An array of identical unnamed objects having two properties, cityName and
weatherURL.

Note that this is untested script, so a bug or two might need working out.

Alternative is to make two vectors (arrays), one of city names with a one-
to-one correspondence with your URLs.

The idea is that it is more tabular, which makes it more readable than a
series of if-else.


</script>

</td></tr></table>
</body>


Jan 19 '06 #2
Thanks for all of the help! Yeah i'm kind of lost on this. Yeah there
are two other pages that work with this one. This is for a portlet
within a portal. So it has to be set up kind of differently. There
are 3 pages. This is the display page. There is an edit page and then
a set user prefs page off of the edit page. I'll put those in here
too. Here's the changes I made according to what I think you said.

Display weather page:
<%@ page language="java" import="java.util.*, java.text.* " %>
<%@ page import="com.plumtree.remote.portlet.*" %>
<%@ page import="com.plumtree.remote.prc.*" %>
<%
String path = request.getContextPath();
String basePath =
request.getScheme()+"://"+request.getServerName()+":"+request.getServerPor t()+path+"/";
%>
<% response.setHeader("Cache-Control", "max-age=3400"); %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>Weather</title>

<!-- <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0"> -->
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<!--
<link rel="stylesheet" type="text/css" href="styles.css">
<link rel='stylesheet'
href='pt://images/plumtree/portal/custom/fh_styles/style.css'>
-->
<body>
<table>
<tr><td>
<script type="text/javascript">
var cityWeather = [
{ cityName: "austin",
weatherURL:
"http://voap.weather.com/weather/oap/NLXX0002?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e"
},
{ cityName: "albany",
weatherURL:
"http://voap.weather.com/weather/oap/USGA0028?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e"
},
{ cityName: "amsterdam",
weatherURL:
"http://voap.weather.com/weather/oap/USTX0057?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e"
},
{ cityName: "beijing",
weatherURL:
"http://voap.weather.com/weather/oap/CHXX0008?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e"
},
{ cityName: "melbourne",
weatherURL:
"http://voap.weather.com/weather/oap/GMXX0007?template=GENXH&par=null&unit=1&key=67d2b0 264796112ce6d75944acad734e"
}
// as many 2-property objects as you have cities and weather
];

for (var i = 0; i < cityWeather.length; i++)
if (city.toLowerCase() ==
cityWeather[i].cityName.toLowerCase())
{
open (cityWeather[i].weatherURL);
break;
}
</script>
</td></tr></table>
</body>

User Prefs Page:
<%@ page language="java" import="java.util.*" %>
<%@ page import="com.plumtree.remote.portlet.*" %>
<%@ page import="com.plumtree.remote.prc.*" %>
<%
String path = request.getContextPath();
String basePath =
request.getScheme()+"://"+request.getServerName()+":"+request.getServerPor t()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>Edit Preferences</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

<link rel='stylesheet'
href='pt://images/plumtree/portal/custom/fh_styles/style.css'>

<script LANGUAGE="JavaScript">
<!--
window.moveTo(100,100);
if (window.screen) self.resizeTo(Width=700,Height=400);

//-->
</script>

</head>

<body>
<%
String cityName = null;
try
{
//get portlet context obj
IPortletContext portletContext =
PortletContextFactory.createPortletContext(request , response);
IRemoteSession remoteSession =
portletContext.getRemotePortalSession();

//Get portlet context object
IPortletRequest portletRequest = portletContext.getRequest();
cityName = portletRequest.getSettingValue(SettingType.User,
"cityName");
if (cityName != null)
{
System.out.println("FHWeather: userPrefs: previous selected
cityName = " + cityName);
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
%>
<form name="userprefs" method="post" action="setUserPrefs.jsp"
id="userPrefs">
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td colspan=4
background="pt://images/plumtree/portal/custom/fh_images/rec_port_graphics/horiz_greyrule.gif">
<img
src="pt://images/plumtree/portal/custom/fh_images/rec_port_graphics/tr.gif"
width="1" height="1"></td>
</tr>
<tr><td colspan=4><p class="pagetitle">Edit Preferences</p>
<p class="pagetext">Use this page to Edit preferences for this
portlet. Click Submit to return to the previous page.</p></td></tr>
<tr><td width="29%">&nbsp;</td></tr>
<tr>
<td colspan=4
background="pt://images/plumtree/portal/custom/fh_images/rec_port_graphics/horiz_greyrule.gif">
<img
src="pt://images/plumtree/portal/custom/fh_images/rec_port_graphics/tr.gif"
width="1" height="1"></td>
</tr>
<tr>
<td valign="top" class="bodytext">Select the cities weather:</td>
<td valign="top" align="left" width="20%"> <table>
<% if (cityName != null && cityName.equalsIgnoreCase("albany"))
{
%>
<tr><td width="126" align="left" class="bodytext"><input
type="radio" name="cityName" value="Albany" checked>Albany</td></tr>
<% }
else
{ %>
<tr><td align="left" class="bodytext"><input type="radio"
name="cityName" value="Albany" >Albany</td></tr>
<% } %>
</table></td>
<td valign="top" align="left" width="20%"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("amsterdam"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Amsterdam" checked>
Amsterdam</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Amsterdam" >
Amsterdam</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left" width="20%"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("atlanta"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Atlanta" checked>
Atlanta</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Atlanta" >
Atlanta</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("austin"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="Austin" checked>
Austin</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Austin" >
Austin</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("beijing"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Beijing" checked>
Beijing</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Beijing" >
Beijing</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("berlin"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Berlin" checked>
Berlin</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Berlin" >
Berlin</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("boston"))
{
%>
<tr>
<td width="143" align="left" class="bodytext"><input
type="radio" name="cityName" value="Boston" checked>
Boston</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Boston" >
Boston</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("brussels"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Brussels" checked>
Brussels</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Daily" >
Brussels</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("buffalo"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Buffalo" checked>
Buffalo</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Buffalo" >
Buffalo</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("calgary"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="Calgary" checked>
Calgary</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Calgary" >
Calgary</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("charlotte"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Charlotte" checked>
Charlotte</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Charlotte" >
Charlotte</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("chicago"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Chicago" checked>
Chicago</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Chicago" >
Chicago</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("cleveland"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="Cleveland" checked>
Albany</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Cleveland" >
Cleveland</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("dallas"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Dallas" checked>
Dallas</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Dallas" >
Dallas</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("detroit"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Detroit" checked>
Detroit</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Detroit" >
Detroit</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("dublin"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="Dublin" checked>
Dublin</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Dublin" >
Dublin</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("edinburgh"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Edinburgh" checked>
Edinburgh</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Edinburgh" >
Edinburgh</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("edmonton"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Edmonton" checked>
Edmonton</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Edmonton" >
Edmonton</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("frankfurt"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="Frankfurt" checked>
Frankfurt</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Frankfurt" >
Frankfurt</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("hongkong"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="HongKong" checked>
Hong Kong</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="HongKong" >
Hong Kong</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("houston"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Houston" checked>
Houston</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Houston" >
Houston</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("johannesburg"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="Johannesburg" checked>
Johannesburg</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Johannesburg" >
Johannesburg</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("kansascityName"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="KansascityName" checked>
Kansas cityName</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="KansascityName" >
Kansas cityName</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("kualalumpur"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="KualaLumpur" checked>
Kuala Lumpur</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Kuala Lumpur" >
Kuala Lumpur</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("london"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="London" checked>
London</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="London" >
London</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("losangeles"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="LosAngeles" checked>
Los Angeles</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Los Angeles" >
Los Angeles</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("madrid"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Madrid" checked>
Madrid</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Madrid" >
Madrid</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("manila"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="Manila" checked>
Manila</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Manila" >
Manila</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("melbourne"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Melbourne" checked>
Melbourne</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Melbourne" >
Melbourne</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("mexico"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Mexico" checked>
Mexico</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Mexico" >
Mexico</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("miami"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="Miami" checked>
Miami</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Miami" >
Miami</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("milan"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Milan" checked>
Milan</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Milan" >
Milan</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("minneapolis"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Minneapolis" checked>
Minneapolis/St. Paul</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Minneapolis" >
Minneapolis/St. Paul</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("montreal"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="Montreal" checked>
Montreal</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Montreal" >
Montreal</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("munich"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Munich" checked>
Munich</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Munich" >
Munich</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("neworleans"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="NewOrleans" checked>
New Orleans</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="New Orleans" >
New Orleans</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("newyork"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="NewYork" checked>
New York</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="New York" >
NewYork</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("ottawa"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Ottawa" checked>
Ottawa</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Ottawa" >
Ottawa</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("paris"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Paris" checked>
Paris</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Paris" >
Paris</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("portland"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="Portland" checked>
Portland</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Portland" >
Portland</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("prague"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Prague" checked>
Prague</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Prague" >
Prague</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("quebec"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Quebec" checked>
Albany</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Quebec" >
Quebec</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("raleighdurham"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="RaleighDurham" checked>
Raleigh-Durham</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="RaleighDurham" >
Raleigh Durham</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("sacramento"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Sacramento" checked>
Sacramento</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Sacramento" >
Sacramento</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("sanantonio"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="SanAntonio" checked>
San Antonio</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="San Antonio" >
San Antonio</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("sandiego"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="SanDiego" checked>
San Diego</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="SanDiego" >
San Diego</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("sanfrancisco"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="SanFrancisco" checked>
San Francisco</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="SanFrancisco" >
San Francisco</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("sanjuan"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="SanJuan" checked>
San Juan</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="SanJuan" >
San Juan</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("seattle"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="Seattle" checked>
Seattle</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Seattle" >
Seattle</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("seoul"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Seoul" checked>
Seoul</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Seoul" >
Seoul</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("shanghai"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Shanghai" checked>
Shanghai</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Shanghai" >
Shanghai</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("singapore"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="Singapore" checked>
Singapore</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Singapore" >
Singapore</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("StLouis"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="StLouis" checked>
St. Louis</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="StLouis" >
St. Louis</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("sydney"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Sydney" checked>
Sydney</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Sydney" >
Sydney</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("tokyo"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="Tokyo" checked>
Tokyo</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Tokyo" >
Tokyo</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("toronto"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Toronto" checked>
Toronto</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Toronto" >
Toronto</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("vancouver"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Vancouver" checked>
Vancouver</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Vancouver" >
Vancouver</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td valign="top" class="bodytext">&nbsp;</td>
<td valign="top" align="left">
<table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("warsaw"))
{
%>
<tr>
<td width="146" align="left" class="bodytext"><input
type="radio" name="cityName" value="Warsaw" checked>
Warsaw</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Warsaw" >
Warsaw</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("washington"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Washington" checked>
Washington D.C.</td>
</tr>
<% }
else
{ %>
<tr>
<td height="21" align="left" class="bodytext"><input
type="radio" name="cityName" value="Washington" >
Washington D.C.</td>
</tr>
<% } %>
</table></td>
<td valign="top" align="left"><table>
<% if (cityName != null &&
cityName.equalsIgnoreCase("albany"))
{
%>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Albany" checked>
Albany</td>
</tr>
<% }
else
{ %>
<tr>
<td align="left" class="bodytext"><input type="radio"
name="cityName" value="Daily" >
Albany</td>
</tr>
<% } %>
</table></td>
</tr>
<tr>
<td class="bodytext"><input type="submit" name="SubmitButton"
id="SubmitButton" value="Submit"></td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td colspan=4
background="pt://images/plumtree/portal/custom/fh_images/rec_port_graphics/horiz_greyrule.gif">
<img
src="pt://images/plumtree/portal/custom/fh_images/rec_port_graphics/tr.gif"
width="1" height="1"></td>
</tr>
</table>
</form>
<jsp:include page="FHFooter.jsp"/>

</body>
</html>
Set User Prefs Page:
<%@ page language="java" import="com.plumtree.remote.portlet.*"
contentType="text/html;charset=UTF-8" %>
<%
String path = request.getContextPath();
String basePath =
request.getScheme()+"://"+request.getServerName()+":"+request.getServerPor t()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'setAdminPrefs.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>

<body>
<%
//Get portlet context object
IPortletContext portletContext =
PortletContextFactory.createPortletContext(request ,response);
IPortletResponse portletResponse = portletContext.getResponse();

//Get user name from incoming form, and set it into the
portletResponse
String cityName = request.getParameter("cityName");
if (cityName == null)
{
System.out.println("FHWeather: setUserPrefs: selected cityNameName
is null, set default StLouis");
cityName = "StLouis";
}

System.out.println("FHWeather: setUserPrefs: cityName = " +
cityName);

IPortletRequest portletRequest = portletContext.getRequest();
portletResponse.setSettingValue(SettingType.User, "cityName",
cityName);

System.out.println("FHWeather: setUserPrefs: cityName = " +
portletRequest.getSettingValue(SettingType.User, "cityName"));

portletResponse.returnToPortal();
%>
</body>
</html>
Thanks!

Jan 19 '06 #3
Br**********@hotmail.com wrote:
Thanks for all of the help! Yeah i'm kind of lost on this. Yeah there
are two other pages that work with this one. This is for a portlet
within a portal. So it has to be set up kind of differently. There
are 3 pages. This is the display page. There is an edit page and then
a set user prefs page off of the edit page. I'll put those in here
too. Here's the changes I made according to what I think you said.

Display weather page:
<%@ page language="java" import="java.util.*, java.text.* " %>
<%@ page import="com.plumtree.remote.portlet.*" %>
<%@ page import="com.plumtree.remote.prc.*" %>
<%
String path = request.getContextPath();
String basePath =
request.getScheme()+"://"+request.getServerName()+":"+request.getServerPor t()+path+"/";
%>
<% response.setHeader("Cache-Control", "max-age=3400"); %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>Weather</title>

<!-- <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0"> -->
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<!--
<link rel="stylesheet" type="text/css" href="styles.css">
<link rel='stylesheet'
href='pt://images/plumtree/portal/custom/fh_styles/style.css'>
-->
<body>
<table>
<tr><td>
<script type="text/javascript">
var cityWeather = [
{ cityName: "austin",
weatherURL:
"http://voap.weather.com/weather/oap/NLXX0002?template=GENXH&par=null&unit=0&key=67d2b0 264796112ce6d75944acad734e"
},


A better idea is to use the city name as the key for the URLs:

var cityWeather = {
"austin" : "http://voap.weather.com/weather/...",
"albany" : "http://voap.weather.com/weather/...",
"melbourne" : "http://voap.weather.com/weather/...",
"st lucia" : "http://voap.weather.com/weather/..."
};
Presuming the city name was set elsewhere, you can do something like:

var cityKey = city.toLowerCase();
if (cityKey in cityWeather) open (cityWeather[cityKey]);
No looping. The URL values "http://voap.weather.com/weather/..." should
be replaced with the real values of course, and I'm guessing that you
have an 'open' function defined somewhere.
[...]
--
Rob
Jan 19 '06 #4
JRS: In article <Xn**********************@207.115.17.102>, dated Thu,
19 Jan 2006 19:26:53 remote, seen in news:comp.lang.javascript, Winston
Smith, American Patriot <Fr********@Oceania.WhiteHouse.GOV> posted :

var cityWeather = [
{ cityName: "city1name",
weatherURL: "http://my.weather.url/for/city?number=1" },
{ cityName: "city2name",
weatherURL: "http://my.weather.url/for/city?number=2" },
{ cityName: "city13ame",
weatherURL: "http://my.weather.url/for/city?number=3" },
{ cityName: "city4name",
weatherURL: "http://my.weather.url/for/city?number=4" },
{ cityName: "city5name",
weatherURL: "http://my.weather.url/for/city?number=5" }
// as many 2-property objects as you have cities and weather
];

For a list of that sort of length, the above being a subset, one should
factor out most or all of the constant part, "http://my.weather.url/..."

Under the circumstances, shorter forms than cityName and WeatherURL
might be preferable; "city" and "URL" maybe.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jan 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: George Hester | last post by:
In a page I have when the user left-clicks the page a Input box for a form gets the focus. But if the user right-clicks the page the Input box is not getting the focus. I'd like the Input box to...
4
by: JesusFreak | last post by:
From: us_traveller@yahoo.com (JesusFreak) Newsgroups: microsoft.public.scripting.jscript Subject: toolbar script problem NNTP-Posting-Host: 192.92.126.136 Recently, I downloaded the following...
2
by: Axel Foley | last post by:
Hi Folks, i'm newbie at JS; but "learning by tweaking" is my middle name! Trying to set up a link partnership application on a client's site; got this script at "The Javascript Source", but it...
3
by: P Wolpert | last post by:
This is my first post. I hope I don't sound stupid. I have a script conflict when I put two scripts on one page. Both scripts will work if I use one at a time but the menu button script will not...
2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
7
by: fox | last post by:
Hi, Lacking javascript knowledge, I just realized why my project has a bug. I am using ASP to loop through a set of records while it creates URLs with a querystring that has a single value pair....
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
3
by: aashishn86 | last post by:
var weekend = ; var weekendColor = "#e0e0e0"; var fontface = "Verdana"; var fontsize = 1; var gNow = new Date(); var ggWinCal; isNav = (navigator.appName.indexOf("Netscape") != -1) ? true :...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.