• 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

jsp:setbean with param attribute

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am learning jsp and trying to run following code in jsp :

I am setting name to psaaword(value 12345) but browser still dispalys Priyanka.
Please tell how can I display 12345 instead of priyanka.


[BSouther: Added UBB CODE tags]
[ September 03, 2007: Message edited by: Ben Souther ]
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What name/value pairs are you posting? Is the name bean in the request scope or are you creating it in the JSP via the useBean tag?

We need more information please.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are setting an attribute called "psaaword" in request scope. The attribute "param" of jsp:setProperty is not referring to request attributes, but to request parameters, and there is no request parameter called "psaaword". In this case, if the param is not set in the Request object, or if it has the value of "", the jsp:setProperty action has no effect.
 
priya kakkar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If its not setting value in attribute then what is request.setattribute doing here .
Please give me some way to use param and hence request attribute in my jsp
so that the output comes out to be 12345 not priyanka
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

what is request.setattribute doing here


I'm the one asking this You didn't write this code ?

Please give me some way to use param and hence request attribute in my jsp so that the output comes out to be 12345 not priyanka


You either use request parameters or request attributes. You cannot say "hence request attributes".

If you want to use request parameters, you can add their values at the end of the url. For example, if you are trying to access bean.jsp, you can add "?psaaword=12345" after it : http://localhost:8080/myapp/bean.jsp?psaaword=12345. setAttribute is no use in this case.

You could use request attributes with EL, without the "param" attribute :
 
I found a beautiful pie. And a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic