Posted on 2005-05-08
Last Modified: 2010-03-31

I have one localhost/test/main.jsp that called LoginForm and LoginAction subsequently. Then, in my LoginForm, if the errors are obtained, the application will be sent back to main.jsp automatically with the <html:errors /> displayed, right? However, my ActionLogin URL is similar like localhost/test/login/ So when I get back, all the images URL are wrong. My question is how to solve that problem?

The images URL would be like localhost/test/login/pic12.gif instead of localhost/test/pic12.gif

Question by:suprapto45
    LVL 15

    Expert Comment

    Have the full path for your images in the jsp page.
    e.g. (<img src="/test/login/pic12.gif" />). [assuming test is your context name]
    LVL 15

    Accepted Solution

    It is generaly bad idea to have your images relative to your pages as if you change the page location all your images from it will be broken.
    You could still solve the problem without applying the above suggestion by using forwared redirect to /test/main.jsp but I prefer the above way.
    LVL 29

    Assisted Solution

    Or use the html:base tag, see here

    Else I agree with Arie and would say use the context relative solution.
    LVL 16

    Author Comment

    Hi thanks,

    Sorry for the delay. I have no time to test. I hope I can test it late today. sorrry :)

    LVL 29

    Expert Comment

    Cheers Dave

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Suggested Solutions

    INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
    Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    759 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