-
1. Re: How to Print " " instead of "null" when printing a null variable in JBoss AS 7.1
jaikiran Oct 1, 2012 12:33 PM (in response to rjanapala)Print where? And how do you print those values? Why not just do something like this in your code:
foo == null ? " " : foo
-
2. Re: How to Print " " instead of "null" when printing a null variable in JBoss AS 7.1
rjanapala Oct 1, 2012 2:11 PM (in response to jaikiran)Hi Jaikiran,
Print where? On Runtime when any of the expression in the scriptlets returns null value it will be converted to "" when the print-nulls values is set false. Generaly it will be converted to "null", due that you will see a 'null' values in screens.
In weblogic print-nulls provides a way to control whether a null value is converted to an empty string or "null" string in a response. If print-nulls is set to true, then the null value is converted to a "null" string. If printNulls is false, then a null value is converted to an empty string instead of a "null" value.
Does Jboss has any such option to convert the "null" like that.
-
3. Re: How to Print " " instead of "null" when printing a null variable in JBoss AS 7.1
ctomc Oct 1, 2012 2:25 PM (in response to rjanapala)Still, where are you using this?
jsf expresions? jsp expressions?
-
4. Re: How to Print " " instead of "null" when printing a null variable in JBoss AS 7.1
majetyravi Dec 22, 2012 1:56 PM (in response to ctomc)well..i am also facing the similar issue. as jai kiran said, we can enforce a null comparison before sending it to screen, but here this is weblogic to jboss server migration and application is already running for nearly 5 years, so making code changes for this is not a good idea and impact would be high.
well Tomaz, we are facing this issue mainly in jsp when we trying to display a value of java variable using scriplets.
Please provide a solution to this.
Thank you.
-
5. Re: How to Print " " instead of "null" when printing a null variable in JBoss AS 7.1
jaikiran Dec 23, 2012 12:27 AM (in response to majetyravi)Ravi Kiran Majety wrote:
but here this is weblogic to jboss server migration and application is already running for nearly 5 years, so making code changes for this is not a good idea and impact would be high.
The real issue is that the application relied on a server specific feature which isn't guaranteed to be available in other servers. To me this looks like something which the application itself should be handling rather than looking for the application server to do it.
-
6. Re: How to Print " " instead of "null" when printing a null variable in JBoss AS 7.1
majetyravi Dec 23, 2012 12:45 PM (in response to jaikiran)HI Jai,
As you said, the application relied on a server specifc feature, i agree wit that, this migration is only for development purpose, so i am looking for a smart solution which would limit me to change less no of files instead of all files.
-
7. Re: How to Print " " instead of "null" when printing a null variable in JBoss AS 7.1
rajasundaram May 21, 2014 12:17 PM (in response to rjanapala)Hi Ram,
We are facing the same issue on our migration project. Any luck?
Thanks,
Raj
-
8. Re: How to Print " " instead of "null" when printing a null variable in JBoss AS 7.1
sgilda May 21, 2014 4:06 PM (in response to rjanapala)I'm not sure if this is any help, but I've added a topic from the WebLogic Migration Guide here:
-
9. Re: How to Print " " instead of "null" when printing a null variable in JBoss AS 7.1
rajasundaram May 21, 2014 4:51 PM (in response to sgilda)I looked at the source code of JspWriterImpl in org.apache.jasper.runtime package and the print(String) written like this...
public void print(String s) throws IOException { if (s == null) { s = "null"; } write(s); } I changed s="null" to s="" and it works. I want to overwrite the method by extending the JspWriterImpl class.
Is there any setting in JBoss to load my overwritten class based on the application? Or is there any setting in JBoss to take the custom JspWriter?
Please help.