Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

value not going from jsp to servlet  RSS feed

 
sanket jani
Ranch Hand
Posts: 47
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friends
i have one problem with the servlet

i have jsp code on which value is displaying
so i set it in hidden parameter.
but when fetching this value on servlet it gives null

please help in this..

following is servlet code in which i am trying to fetch


following is the jsp code on which value is displaying correctly

 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sanket jani wrote:
<%
String userName = String.valueOf(request.getAttribute("usrName"));
%>

Are you sure you are not getting null [code]request.getAttribute("usrName")[code] over here.
Use type casting don't use String.valueOf.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using a multi-part form? The request methods do not work with any but url-encoded forms (the default).
 
sanket jani
Ranch Hand
Posts: 47
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok thanks
got the solution
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps you could post back with that solution to help others?
 
sanket jani
Ranch Hand
Posts: 47
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i just added the following annotation on top of the class and its working fine now.

thank you very much all friends for your valuable response....

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!