Struts: Problem rewrite page for links and images

Posted on 2006-03-25
Last Modified: 2010-04-01

I'm new to Struts, and I'm developing my first web application using Struts.  Actually I'm just following the guidelines of the tutorial that I have.

Currently I'm facing 2 problems:

1) Images:  According to my tutorial, you can use page rewrite when you use images in a tile.    
    So what I do is this:
    - in the head I define:
      <%@ taglib uri="" prefix="tiles" %>
      <%@ taglib uri="" prefix="html" %>
    - to put the image, I use:
      <img src="<html:rewrite page='/imgs/chimay01.bmp'/>">

    The problem is that the img doens't show.  I checked that the url and everything is correct,
    but apparently that ain't the problem.

2) Links:  When I click on them, they don't redirect.  You can hear the typical "click", but ...
    that's all.
    - I define them like this:
      <a href="html:rewrite page='/history.jsp'/>">History</a>

Now, the rewrite page works perfectly for the stylesheet when I use this:
<link rel="stylesheet" href="<html:rewrite page='/css/styles01.css'/>" type="text/css">

I read somewhere that, to use images and rewrite page, you should put the value $P in the pagePattern.  I guess that refers to the struts-config file, so what I did there was this:

Any suggestions?

Thanks in advance


Question by:s5020847
    LVL 11

    Expert Comment


    r u using Tiles? if not, there is no need to define the processor class. Moreover, why do u need the pagePattern? Any special reason for pagePattern? There is nothing like you need to use a special pagePattern for using rewrite tag.

    remove the controller element and check it.



    Author Comment


    Yes, I'm using tiles.  I'm not really sure what the page pattern does actually ... I just read somewhere that you need it for images that use rewrite page ... :o(

    Anyway, I took the pagePattern away, but the problem is still the same ...

    Author Comment

    I found it!  The thing is that you have to put the following line in the tile itself:

     <%@ taglib uri="" prefix="html" %>


    Accepted Solution

    PAQed with points refunded (125)

    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Title # Comments Views Activity
    How to write service layer in Spring ? 4 256
    method inner class 6 76
    rebasing and merging used in SCM 1 56
    build fail in maven project 11 157
    PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
    Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now