Unanswered Question
Mar 23rd, 2007


I've been patching up the speeddials.jsp xml service from the IPPhone SDK as it doesn't seem to compile out-of-the-box (or is there a likely step I'm missing? - problems seems to be that the done/delete buttons don't work and it uses xmlencoder in a way that no longer seems to work).

At any rate, I have it working, but have had to take this line out:

response.sendRedirect(thisPage + "&action=update&index=" + index);

in favour of sending back a CiscoIPPhoneExecute object to refer to the URL:

out.print("<CiscoIPPhoneExecute><ExecuteItem URL=");

out.print("\"" + thisPage + StringEscapeUtils.escapeXml("&action=update&index=") + index + "\"");


Do the phones not accept redirects?

If I use the redirect, it just displays 'Host Not Found'.



I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 3 (2 ratings)
Gergely Szabo Fri, 03/23/2007 - 07:55

Hi there,

you must have JDK installed if you want to run/compile JSP pages (actually, JSP's just compile into servlets and then these servlets get executed, actually).

And, the Java samples that come with the SDK are... not too elegant. They are quite alright for a quick and dirty ehm solution, but there is a nicer way to do the job if you want to go the Java way.

For instance, the code fragment above is generating XML like Larry. out.println... come on...

- Stick to servlets (already compiled to Java bytecode, no surprises like compilation errors when deploying etc).

- use SAX or, if you are sure you have enough RAM installed, use DOM. There are many options to choose from, personally, I prefer SAX, but JDOM is a good option too.

Aaron Harrison Sat, 03/24/2007 - 08:50


I do have JDK installed (hence why the altered pages compile)... Also I know there are better ways to use XML but I'm doing the basics first..

The question I'm really interested in is why didn't the response.sendredirect work; is this just something the phone's browser doesn't support?



msabir Sun, 03/25/2007 - 08:52

It appears that you have a relative URL in response.sendRedirect. I have used redirect and it worked fine. Web browser can understand relative URLS (/newPage.jsp), but for phones, you have to give complete URL (http://xx.xx.xx.xx/App/newPage.jsp). See the following JSP page that works fine on all phones:

<%@ page language="java" %>

<%@ page import="*, java.util.*, java.lang.*,*" %>

<%@ page import ="javax.servlet.*, javax.servlet.http.*" %>


String thisPath = request.getRequestURI();

String thisContext = request.getContextPath();

String thisServer = InetAddress.getLocalHost().getHostAddress();

int thisPort = request.getServerPort();

String thisApp = "http://" + thisServer + ":" + thisPort + thisContext;



Aaron Harrison Mon, 03/26/2007 - 02:06

Good suggestion; but the jsp I'm using does form the full URL:

String thisPage = "http://" + thisServer + ":" + thisPort + thisPath + "?name=" + deviceName;

Any more ideas?



msabir Mon, 03/26/2007 - 15:56

Can you open it in the web browser and copy paste the XML you are getting?


This Discussion