Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get values from httpservlet to genericservlet

 
m phani chand
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • 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
  • 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
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic