You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Mili Aggarwal, Noida" <mi...@noida.hcltech.com> on 2005/03/17 14:25:24 UTC

Displaying XL in browser

Hello All,
	I wish to display an Excel in browser. I am using struts framework.
Thus,in Action I have returned an ActionForward to a servlet that displays
the Excel.

The problem am facing is-.> If I try to open more than 1 Excel from the
website,it gives the error that cannot open more than one file with the same
name -since the servlet name becomes the name of the Excel.

What is the alternative to show more than 1 Excel?????????


Disclaimer: 

This message and any attachment(s) contained here are information that is
confidential,proprietary to HCL Technologies and its customers, privileged
or otherwise protected by law.The information is solely intended for the
individual or the entity it is addressed to. If you are not the intended
recipient of this message, you are not authorized to read, forward,
print,retain, copy or disseminate this message or any part of it. If you
have received this e-mail in error, please notify the sender immediately by
return e-mail and delete it from your computer.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Displaying XL in browser

Posted by Tom Ziemer <t....@dkfz-heidelberg.de>.
Hi,

you could try to use

response.addHeader("Content-Disposition", "inline; filename=filename");

and set the "filename" dynamically.

Ta Ta For Now,

Tom

Mili Aggarwal, Noida wrote:
> Hello All,
> 	I wish to display an Excel in browser. I am using struts framework.
> Thus,in Action I have returned an ActionForward to a servlet that displays
> the Excel.
> 
> The problem am facing is-.> If I try to open more than 1 Excel from the
> website,it gives the error that cannot open more than one file with the same
> name -since the servlet name becomes the name of the Excel.
> 
> What is the alternative to show more than 1 Excel?????????
> 
> 
> Disclaimer: 
> 
> This message and any attachment(s) contained here are information that is
> confidential,proprietary to HCL Technologies and its customers, privileged
> or otherwise protected by law.The information is solely intended for the
> individual or the entity it is addressed to. If you are not the intended
> recipient of this message, you are not authorized to read, forward,
> print,retain, copy or disseminate this message or any part of it. If you
> have received this e-mail in error, please notify the sender immediately by
> return e-mail and delete it from your computer.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Displaying XL in browser

Posted by Jeff Beal <jb...@gmail.com>.
Just off the top of my head here, I'd try having a servlet mapping
that looks like this:

  <servlet-mapping>
    <servlet-name>ExcelServlet</servlet-name>
    <url-pattern>/excel/*.xls</url-pattern>
  </servlet-mapping>

Then, in your links to the servlet, use a randomly generated string
for the '*' part.  Your browser will see this as a different name each
time.

Since you're using a Struts Forward for this, you'll have to do a bit
of extra stuff to change the path on the forward, but that's not too
hard.  Have a look at the Javadocs.  The only thing you *can't* do is
modify a forward that's set up in the configuration file.  But you can
easily create a copy of that and modify the path property.

-- Jeff


On Thu, 17 Mar 2005 18:55:24 +0530, Mili Aggarwal, Noida
<mi...@noida.hcltech.com> wrote:
> Hello All,
>         I wish to display an Excel in browser. I am using struts framework.
> Thus,in Action I have returned an ActionForward to a servlet that displays
> the Excel.
> 
> The problem am facing is-.> If I try to open more than 1 Excel from the
> website,it gives the error that cannot open more than one file with the same
> name -since the servlet name becomes the name of the Excel.
> 
> What is the alternative to show more than 1 Excel?????????
> 
> Disclaimer:
> 
> This message and any attachment(s) contained here are information that is
> confidential,proprietary to HCL Technologies and its customers, privileged
> or otherwise protected by law.The information is solely intended for the
> individual or the entity it is addressed to. If you are not the intended
> recipient of this message, you are not authorized to read, forward,
> print,retain, copy or disseminate this message or any part of it. If you
> have received this e-mail in error, please notify the sender immediately by
> return e-mail and delete it from your computer.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
Jeff Beal
Webmedx, Inc.
Pittsburgh, PA USA

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org