File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Show text attachment in Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Show text attachment in Servlet" Watch "Show text attachment in Servlet" New topic

Show text attachment in Servlet

jagadish r

Joined: Aug 29, 2007
Posts: 7
Hi Guys,

I am wokring to displaying data in TEXTAREA of jsp page as text attachment.

No error but attachment showing all jsp page code with textarea data.

I need only textarea data...

Here is my JSP and servelt code

jsp code:-

<form action="/servlet/SaveResponse" method="post">
<td><textarea name="responseMsg" rows="22" cols="75" readonly="readonly"><%=(String)session.getAttribute("respMsg")%></textarea></td>
<%} %>

Servlet Code:

String saveMsg=request.getParameter("responseMsg");
String filename="xyz.txt";
ServletOutputStream outStream = response.getOutputStream();response.setContentType("text/plain");

David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

"jagadish r",
Please check your private messages.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Show text attachment in Servlet
It's not a secret anymore!