Thursday, December 18, 2014

Expression language (EL) and jstl tags in JSP

Expression language is very useful and powerful tool available for developers. With JSTL tags and expression language, we can avoid Scriptlets in JSP to make JSP code more clear and maintainable.

Here are few examples to use EL with jstl tags to perform logical operations required in JSP:

1. Condition to check value is not null or blank:
If you want to check value of "abc"  variable is not blank and not null
<c:if test="${not empty abc}">
Your HTML/JSP code
</c:if>
To print value you can also use
${not empty abc ?abc:xyz}

2. Comparision     
<c:if test="${abc eq '1'}">
Your HTML/JSP code
</c:if>
3. Multiple condition

 You can use multiple if-else condition
<c:choose>
                                    <c:when test="${not empty abc}">
                                        Code when abc not empty
                                    </c:when>
                                    <c:when test="${not empty xyz}">
                                        Code when xyz not empty
                                    </c:when>                                   
                                    <c:otherwise>
                                        Code when both abc and xyz empty
            </c:otherwise>
</c:choose>

Tuesday, July 1, 2014

How to increase SOAP request timeout value in Websphere

How to increase SOAP request timeout value in Websphere?
Change "com.ibm.SOAP.requestTimeout" configuration setting.

Path : {WebSphere-Profile-Root-Folder}\properties
File name: soap.client.props
Parameter:
com.ibm.SOAP.requestTimeout : Default value is 180, 0 implies no timeout

So when is 180 seconds timeout not enough?
Answer:  Build automation tools like Jenkins use SOAP connectivity port to deploy applications and there might be "Connection reset" error if deployment step takes more than 180 seconds.

 Exception stack trace :
exception information: com.ibm.websphere.management.exception.ConnectorException
[wsadmin] org.apache.soap.SOAPException: [SOAPException: 
faultCode=SOAP-ENV:Client; msg=Connection reset; 
targetException=java.net.SocketException: Connection reset]

Tuesday, March 4, 2014

Java 8: Release date 18th March 2014

Finally, Java 8 is releasing in few days on 18th March. Every java developer is excited to know what new features are coming.
Lambda expressions, default and static methods in Interface are few new features.
Lambda expressions will be much talked subject after people start using it.
Reality is, industry is always 5 years behind in using latest version of java.
Lets see and explore Java 8 after 18th March.