Thursday, February 21, 2008

JSP syntax: empty checks, params, misc

This stuff is so elementary that i am always annoyed to forget it every time i dont use jsp for a few months.

1. Get params from the url request, ie
<c:out value="param1 is: ${param.param1} something is:${param.something}"/>

also there is ${params} for getting lists, but i would need to read up on that

2. checking if a request attribute is null or empty:
<c:if test="${ != null && not empty}">
<c:import url="${base_html_dir}${}"></c:import>

3. setting variables:
<c:set var="thingToSet" value="${1+ 3}">
this by default has the scope of 'page', also can be 'session' defined by attribute 'scope'

ill add more as i go

No comments:

Post a Comment