aspose file tools*
The moose likes Websphere and the fly likes jsp - hidden element - null to empty string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "jsp - hidden element - null to empty string" Watch "jsp - hidden element - null to empty string" New topic
Author

jsp - hidden element - null to empty string

Anitha Krishnamurthi
Greenhorn

Joined: Nov 29, 2004
Posts: 26
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
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Anitha Krishnamurthi
Greenhorn

Joined: Nov 29, 2004
Posts: 26
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

Joined: Dec 11, 2004
Posts: 13410

Not sure but I'll move this to our Websphere forum for you.
Anitha Krishnamurthi
Greenhorn

Joined: Nov 29, 2004
Posts: 26
Thanks Ben.. Hoping to get a solution soon....

Regards,
Anitha
 
 
subject: jsp - hidden element - null to empty string