Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

HttpServletRequest API

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm trying to work on a small eCommerce application (Just like shopping cart). My controller should be able select different helper classes to perform different actions like authentication etc. I was going through PetStore application at Pet Store - Front Controller for my application.

My question is assuming view1, view2, view3 .... view n all these views call/being selected by only one controller. How can we find which view is calling the controller, in our controller code, so that we can use some if else kind of logic to select our own workflow .
 
Schandha Ravi
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the Front Controller pattern given in PetStore application, there is a method call request.getPathInfo(), in doGet() method. I tried the same method call. But evertime I invoke, it is always returning me null. What does that method do?
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

there is a method call request.getPathInfo(), in doGet() method. I tried the same method call. But evertime I invoke, it is always returning me null. What does that method do?



It only returns something if the URL has extra path info. The first paragraph of the javadocs explain (very briefly) what extra path info. Suppose you're accessing the URL

and the servlet is configured to listen to "myServlet", then "myBadaBing" is the extra path info. Playing around with different URLs will give you a feeling for it.
 
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!