This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Change text in servlet response with filter ?" Watch "Change text in servlet response with filter ?" New topic
Author

Change text in servlet response with filter ?

Juergen Unfried
Greenhorn

Joined: Oct 11, 2006
Posts: 5
Hello,

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?

cheers,

Juergen
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

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


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
 
subject: Change text in servlet response with filter ?
 
Similar Threads
How to send text message to my mobile?
HFJS: Filters + Wrappers Explaination pg 721
"After" filter?
Capturing JSP Content Within My Strut Action Servlet
HTTP Response