• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why execute twice doGet mothed in servlet!

 
xiaojun chen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I using MVC formwork in UI. When Jsp file link a css file. So it will be execute twice doGet mothed in servlet. When I don't link this css file. It will be Ok. Please tell me what problem? Web container is weblogic. :roll:
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not a web services question.
Post this to either the "WebLogic" forum or the "Servlets" forum.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the Servlets Forum.
Kyle
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sounds to me like a mapping problem in your web.xml. When the browser loads the result of your servlet execution, it sees the link to the css. The browser then makes a get request to the server to load your css. Now, if your mapping causes this get request to be routed to the servlet, this would result in the doGet method being call for your css. Make sure your mapping is such it will only get called on the appropriate get requests.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Carl is correct. I'm betting that you are using a relative path to your css; something like:

Changing the relative path to a full path will most likely solve your problem.
hth,
bear
 
xiaojun chen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I think you are right. But how to set up web.xml and how to link that css. My jsp file link css is the following.
<link href="test.css" rel="STYLESHEET" type="text/css">
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the CSS is grabbed by the browser just like any other resource, why not use the HTML <base> tag to establish the base url? Then the browser will look relative to that base. You should not have to do anything to web.xml.
Bill
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I'm afraid is he has a servlet mapping like

And the link to the style sheet is:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic