Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

servlet doGet is launched twice through servlet annotation calling  RSS feed

 
Eduard Tarassov
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For some reasons my servlet doGet method is being called twice. I am calling servlet from the index.jsp page by using servlet annotation "/Profile/*. And it passes path as localhost:1919/Profile/username to getPost method.



Servlet Profile retrieves data from the java container stores it as an attribute and forwards to profile.jsp page.



My profile.jsp page uses java code to show all the data (and it shows it perfectly). But then I click link to the next update_profile.jsp page. Just simple link. Then I realize that on this step for strange reasons for me doGet method from Profile servlet is called the second time. And passes path as localhost:1919/Profile/update_profile.jsp

Here is my profile.jsp code:



Here is my web.xml file:



And my tomcat run configuration settings: https://drive.google.com/file/d/0ByZXQ2R3O8B8SERPYzJxZFViLVE/view?usp=sharing
and
https://drive.google.com/file/d/0ByZXQ2R3O8B8THE3TGFnUFVpNjg/view?usp=sharing

Thank you very much for your help in advance!
 
Eduard Tarassov
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okey, so just simple slash solved everything for me. I was using relative path. href="/update_profile.jsp">
 
Devaka Cooray
Marshal
Posts: 5512
687
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good catch. Make it relative to the context to make sure it works on all circumstances. Something like...
${pageContext.request.contextPath}/update_profile.jsp
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!