2 Replies - 1050 Views - Last Post: 14 February 2012 - 10:16 AM

Topic Sponsor:

#1 Jay0830  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 01-June 10

Link path question

Posted 01 February 2012 - 02:40 PM

I just started using servlet to build a website, now I encounter a easy problem....but I don't know how to solve it..

Question is:
I have a page call "index.jsp", it contain an image get from a servlet
<img src="servlet/loadImage?file=logo.jpg" id="cloth" onload="btn.disabled=false;"/><br>


When user click submit button, it link to another servlet
<form action="servlet/login" method="post">


if there has any error, the login servlet send back to index.jsp using RequestDispatcher
            RequestDispatcher dispatcher=request.getRequestDispatcher("/index.jsp?action=register");
            dispatcher.forward(request, response);


the problem is when login servlet redirects back to index.jsp, the image path will become
http://localhost:8084/MyOutfit/servlet/servlet/loadImage?file=logo.jpg



How to solve this problem? Thanks
and sorry about my poor English....

Is This A Good Question/Topic? 0
  • +

Replies To: Link path question

#2 Jay0830  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 01-June 10

Re: Link path question

Posted 13 February 2012 - 10:55 AM

I still can't find a way to solve this problem....
any suggestion?
Was This Post Helpful? 0
  • +
  • -

#3 guido-granobles  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 168
  • View blog
  • Posts: 612
  • Joined: 02-December 09

Re: Link path question

Posted 14 February 2012 - 10:16 AM

It seems that you are using servlet/* in web.xml for servlet-mapping, if so you wouldn't need the path servlet/login but just login or loadImage or whatever servlet you need.

This post has been edited by guido-granobles: 14 February 2012 - 10:17 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1