• Post Reply Bookmark Topic Watch Topic
  • New Topic

Attribute Setting failed  RSS feed

 
sankey jain
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unable to receive the String parameter value set through request.setAttribute(...) method in the immediate action class


The above code is to set the value in the attribute called Att

Retrieving the same in the immediate action class as:


The output is displaying as "From Attributenull"

Please help me in this
 
sankey jain
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sankey jain wrote:Unable to receive the String parameter value set through request.setAttribute(...) method in the immediate action class


The above code is to set the value in the attribute called Att

Retrieving the same in the immediate action class as:


The output is displaying as "From Attributenull"

Please help me in this


Apart from the aboove I tried the option of setting in hidden variable........as below


Retrieving as


Even this is failing and returning as null
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure, cname itself is not null..
 
sankey jain
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prasad Krishnegowda wrote:Are you sure, cname itself is not null..


Yes, i have already tried printing it, it is showing up
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Obviously your first attempt won't work, because it's a new request on form submission.

If the hidden field is set to a value, and the form is submitted, it's a parameter, not an attribute.
 
sankey jain
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Obviously your first attempt won't work, because it's a new request on form submission.

If the hidden field is set to a value, and the form is submitted, it's a parameter, not an attribute.


Hi David,

Your reply on approach 1 understood.

On approach 2, you are telling me that when we set a value to a hidden type, then it s a parameter and not an attribute.
but, in the action class, i am using the getparameter to retrieve the value

wouldnt that be the correct way to retrieve it ? if not how should i receive it.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. If you can't retrieve it, then it isn't being set.
 
sankey jain
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Yes. If you can't retrieve it, then it isn't being set.


okay. Thanks :thumbup:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!