This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Struts and the fly likes Change text in servlet response with filter ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Change text in servlet response with filter ?" Watch "Change text in servlet response with filter ?" New topic

Change text in servlet response with filter ?

Juergen Unfried

Joined: Oct 11, 2006
Posts: 5

I have a Struts 1.x application which serves a webpage for desktop users. Now I have to do an optimized version for smartphones which is working pretty nice. For this mobile version I have to filter out all images and make telephone numbers dialable in the mobile browser.

My plan was to use a filter which works on everything with /mobile/ in the url and basically do a .replaceAll(...). The filter is called but now I am stuck because I have no clue how to change the content of the response. All I find on the net is change content types. I also tried the getWriter() method to get the printwriter but I have no clue on how to change the text content of the repsonse.

any ideas what I am overseeing?


Ankit Garg

Joined: Aug 03, 2008
Posts: 9327

Its easy to find such a thing on google. Example...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
I agree. Here's the link:
subject: Change text in servlet response with filter ?