Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

request.getAttribute returns blank

 
Dhanaji Patil
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

We are migrating our application from Weblogic 9.2 to 10.3.4. I have the below code in java script which runs fine in 9.2 and returns null if attribute is not found in request.

<script type="text/javascript">
var mesg = '<%=request.getAttribute("AlertMsg")%>';
if(mesg != 'null'){
alert(mesg);
}
</script>

But in Weblogic 10.3.4, it returns ' ' (blank space) instead of null. Do i need to add any jar other than weblogic? Why the behaviour is like this? Please guide. Thanks in advance.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the parameter doesn't exist then it should return null, if it exists but does not have a value then it should return the empty string.
Check how you call that page and see which is the correct behaviour.
 
Dhanaji Patil
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks David. But it is giving blank string even though the parameter doesn't exist. In weblogic 9.2, it was giving null for both the cases.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is possibly a bug in Weblogic, although not one that I have seen in other application servers before.
My suggestion is to double check that this is the case then contact Oracle if you're sure, or see if there is a patch or more recent version of that server available.
It would also be useful if you were able to verify that it works as expected in other servers eg Tomcat.
 
Dhanaji Patil
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot David. Will check for the alternatives. Meanwhile if you find anything related to this, then please update. Thanks again.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dhanaji Patil wrote:Thanks David. But it is giving blank string even though the parameter doesn't exist.


Parameter? But you're using getAttribute() to access it. Request parameters and request attributes are not the same thing.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ha! Thanks for the second set of eyes, Paul
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic