Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

passing parameters through url  RSS feed

 
Vijaishanker bala
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is it possible to pass arguments/parameters through url when calling a servlet.
for example i want to call a servlet with an argument as follows

matrix/servletName/argument1
matrix/servletName/argument2

matrix/servletName is the mapping path to servlet as provided in web.xml and argument1 & argument2 are the values I need to read inside the servlet.Is this possible. I don't want to pass a certain parameter as request parameters and hence looking up if the above were possible. If this were possible how can I read argument1 and argument2 inside the servlet.

Regards from Hamburg

Vijai
 
Rashid Mayes
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is possible. Please see HttpServletRequest.getPathInfo().
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cant resist pointing out that what you are talking about is the basis for REST style web services. Here is a nice summary on the REST approach.
Bill
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!