• 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 - hidden element - null to empty string

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I have written following jsp in weblogic 8.1

<%
String sss = null;
%>
<form>
<input type="hidden" name="tx" value="<%=sss%>">
</form>
Checking Hidden null values ....

After deploying the jsp the view source shows the hidden element as
<input type="hidden" name="tx" value="">

but in websphere is shows as <input type="hidden" name="tx" value="null">


how is the null replaced with empty string in case of web logic when I am not doing any transformation.

Please help...

Thanks in Advance
Regards,
Anitha
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JSP compiler is doing that for you.

These days, it's better to use the features of JSP 2.0.
The newer JSP EL expressions ${sss} will automatically convert nulls to empty strings for you.

Note: The Jasper compiler used to do this with JSP expressions but stopped when Tomcat 5.0 came out. I'm not sure but I think Weblogic uses Jasper as its JSP compiler.
 
Anitha Krishnamurthi
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for your response. I found that the following code in weblogic.xml is doing this

<jsp-param>
<param-name>printNulls</param-name>
<param-value>false</param-value>
</jsp-param>

Is there anyway to do the same in Websphere. I am migrating my application from Weblogic to Websphere.

Thanks in Advance

Regards,
Anitha
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure but I'll move this to our Websphere forum for you.
 
Anitha Krishnamurthi
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ben.. Hoping to get a solution soon....

Regards,
Anitha
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic