aspose file tools*
The moose likes JSP and the fly likes jsp:setbean with param attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp:setbean with param attribute" Watch "jsp:setbean with param attribute" New topic
Author

jsp:setbean with param attribute

priya kakkar
Greenhorn

Joined: May 12, 2007
Posts: 25
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 ]
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
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.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

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.


[My Blog]
All roads lead to JavaRanch
priya kakkar
Greenhorn

Joined: May 12, 2007
Posts: 25
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

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 agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp:setbean with param attribute