• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to get values from httpservlet to genericservlet

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
friends,i would like to know whether some values could be retrieved as parameter from a httprequest object to an generic servlet.I have tried this,and i am unable to retrieve them.if any one knows,how to do that,please help me.
you can mail me at mudigonda@rediffmail.com
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The GenericServlet class is in the javax.servlet package and implements the Servlet interface. In the service method, it expects to get a ServletRequest and ServletResponse object.
ServletRequest does support getParameter( String name ) so a GenericServlet should be able to get named parameters.
How are you trying to transmit the parameter values?
Bill

------------------
author of:
 
m phani chand
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Reply to the questionin detail.well,friend ,let me explain my problem exactly.i am developing a shopping cart kind of project,in the first screen,i am providing a login screen that only registered users can get into it.so once a registered userlogs into the site or shopping ,the username is carried on to the nextpage.(here is where my session starts.)i have captured the username into a hidden form field here.so,after the login detection screen,it is very well showing me the category list of the items that i have.Here the user is just subjected to click on any category of items to have a detailed list based on the category.so,i have planned to go for a generic servlet firing(on clicking the hyperlinking).But,the hidden field where i am storing the username is showing null,when i am trying to display that in the generic servlet that i am using for a detailed list.
I am just trying to do something like welcome back+username,as long as he stays in my site,maintaining the session.if it is servlet chain of type HTTPServlets only,then it is working absolutely fine,but when u try to insert a generic one in the middle,it is not able to retrieve it.
2.I also have another kind of strange problem.through a servlet,i am hyperlinking to a static html page,and i am able to retrieve the servlet variables using servletcontext.This is also working absolutely fine when i am using servletrunner.This is happening because i am setting my classpath,where i am calling this servletrunner.But when u use javawebserver,how do u set ur classpath?,or how do i make my servlet contexts working?
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am guessing that ServletRequest and GenericServlet do not know how to extract parameters from an HTML style form. Whats wrong with extending HttpServlet instead of GenericServlet if you are going to be writing HTML pages?
Bill
 
m phani chand
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well,my friend as far as i know,a httpservlet fires when u click on a submit button(right!!!),so that it takes with it the parameters requested.But here i am not going to click on the submit button anywhere,but i am just clicking on the hyperlink,(This clicking on a hyperlink is not considered as action by httpservlet(is it not?).so it would never fire a httpservlet.
I have tried this out,and it was not working.
let me know,if my concepts of understanding are wrong.
thanks for ur prompt reply..
help me if u can,or suggest someother way,how u can do this?
eagerly awaiting ur reply.
 
Hey, check out my mega multi devastator cannon. It's wicked. It makes this tiny ad look weak:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic