Results 1 to 2 of 2
- 02-06-2009, 02:11 PM #1
Member
- Join Date
- Oct 2008
- Posts
- 3
- Rep Power
- 0
contentType="application/vnd.ms-excel" Not Working
I have a page with a grid on it that I want to export to excel. This has been working for quite some time (years) but the other day instead of opening in excel it has been opening in a browser window. Since the code is the same I am thinking it is a problem with a java or tomcat update. Does anyone know if there is a new code instead of: <%--@page contentType="application/vnd.ms-excel"--%>"?
Here is the bulk of my code. Thanks in advance.
-Jordan
<%--@page contentType="application/vnd.ms-excel"--%>
<jsp:useBean id="map" class="com.esri.aims.mtier.model.map.Map" scope="page" />
<%@ page import="java.net.URLEncoder" %>
<%@ page import="javax.xml.parsers.DocumentBuilderFactory" %>
<%@ page import="javax.xml.parsers.DocumentBuilder" %>
<%@ page import="com.esri.aims.mtier.model.map.layer.query. *" %>
<%@ page import="org.w3c.dom.*" %>
<%!
private String formatURLString(String inputURL) {
if (inputURL.indexOf("htt*p://")>-1 || inputURL.indexOf("htt*ps://")>-1 || inputURL.indexOf("ftp://")>-1) {
return inputURL;
} else if (inputURL.indexOf("ww*w.")==0) {
return "htt*p://"+inputURL;
} else {
return "htt*p://"+inputURL;
}
}
String cleanHeader(String h) {
if (h.indexOf('.')>-1) {
h=h.substring(h.lastIndexOf('.')+1,h.length());
}
return h;
}
%>
<%@ include file="setupinc.jsp" %>
<%
if (session.getAttribute("ResultsExport") !=null && request.getParameter("doExport")!=null &&
request.getParameter("doExport").equals("true")) {
try {
recordResult rr = (recordResult)session.getAttribute("ResultsExport" );
if (rr.features!=null && rr.metadata!=null &&
rr.features.length>0 && rr.metadata.fieldNames.length>0) {
out.print("<table border=\"1\" cellspacing=\"0\" class=\"r\"><tr>");
int i, j; // iterators
String str;
for (i=0; i<rr.metadata.fieldNames.length; i++) {
str=cleanHeader(rr.metadata.fieldNames[i]);
if (!str.equalsIgnoreCase("#shape#")) {
out.print("<th>"+str+"</th>");
}
}
out.print("</tr>");
for (i=0; i<rr.features.length; i++) {
out.println("<tr>");
for (j=0; j<rr.features[i].values.length; j++) {
if (!rr.metadata.fieldNames[j].equalsIgnoreCase("#shape#")) {
out.println("<td>"+rr.features[i].values[j]+"</td>");
}
}
out.println("</tr>");
}
out.print("</table>");
} else {
out.print("<table border=\"1\" cellspacing=\"0\" class=\"r\">");
out.print("<tr><th>Null Issue</th></tr></table>");
}
} catch (Exception e) {
out.print("Error: "+e);
}
}
%>
- 02-06-2009, 03:16 PM #2
Member
- Join Date
- Oct 2008
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
Java, Military Format using "/" and "%" Operator!!
By sk8rsam77 in forum New To JavaReplies: 11Last Post: 02-26-2010, 03:03 AM -
[SOLVED] Eclipse-Run As "Java application" missing!!
By Triji in forum EclipseReplies: 5Last Post: 01-27-2009, 03:49 PM -
MoneyOut.println("It took you (whats wrong?>",year,"<WW?) years to repay the loan")
By soc86 in forum New To JavaReplies: 2Last Post: 01-24-2009, 06:56 PM -
pretty much completed hangman, but "new" button is not working
By diggitydoggz in forum New To JavaReplies: 10Last Post: 12-30-2008, 03:46 PM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks