• 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

request.getParameter return null value

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
AJAX has retrieved value(using some DB operation)and inserted in text box.while retrieving that values on onClick event of button System.out.println shows null value.i want to retrieve value of "emp" input tag
jsp file code:-

Ajax JSP Code:-
---------------------
For my testing purpose when i write
on submit button click event i get null value in console but values is get displayed in JSP main page.
 
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this


request.getParameter returns the value not the innerHTML..
 
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The div tag and the input tag have same id: emp
Make them different.
 
Sagar Dumbre
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Prasad Krishnegowda wrote:Try this


request.getParameter returns the value not the innerHTML..



I have provided you whole file code...just go through it..

"ddlFlat" which is also ajax processing... that value retrieving properly in page and in also request.getparameter but the emp value is retrieving properly in page but null when try to get request.getparameter value
 
Sagar Dumbre
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nam Ha Minh wrote:The div tag and the input tag have same id: emp
Make them different.



I've removed ID attribute of input tag..but no use :(
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Remove the id emp from div and put it to the input tag with name emp..

You have got a lot to fix in the code, first thing is no Java inside JSP, its been discredited for 10 years now.
Next, JSP's should be used only as a view, all other processing should be done in the servlets..
 
Sagar Dumbre
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Prasad Krishnegowda wrote:Remove the id emp from div and put it to the input tag with name emp..

You have got a lot to fix in the code, first thing is no Java inside JSP, its been discredited for 10 years now.
Next, JSP's should be used only as a view, all other processing should be done in the servlets..



I have used "getElementByID" method to retrieve the value from Ajax processing page so how can that be done ?
and "document.getElementById("emp").value=xmlHttp1.responseText" when i use this value not printed on jsp page so switched to innerHTML one.
And i know you are talking about MVC but my org. forced me to do whole processing in one JSP page so cant help it.
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sagar Dumbre wrote:i know you are talking about MVC but my org. forced me to do whole processing in one JSP page so cant help it.


If can't believe why the organization(I believe you refer your manager/lead as organization?) don't wan't to get into good practices...
If what you said is correct, then it might well be a good option, to spend some time on Naukri or Monster..

EDIT: i just saw your code, you are returning the whole input tag element only as the AJAX response..
Define the input tags in JSP and just return the values as AJAX response, and use the getElementById('').value to set the AJAX responses to the appropriate fields..
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[thread hijack removed. Please ask your own questions in your own topics.]
 
reply
    Bookmark Topic Watch Topic
  • New Topic