java - JSTL accessing c:set variable and convert into SimpleDateFormat -


i have following sourcecode:

<c:set var="runtimeend" value="${content.valuelist.promotion[0].value.runtimeend}"/> 

which number in jsp , stands date example: 1425769140000

how access variable in java? imean when following wont load page anymore:

<% out.println(${runtimeend}); %> 

i insert variable following java code display date

<% simpledateformat simpledateformat = new simpledateformat("dd mmmmmmmmm yyyy"); out.println(simpledateformat.format(${runtimeend})); %> 

why want use scriplets? work jstl library if have started it.

jstl format date library seems need.

example:

<c:set var="runtimeend" value="${content.valuelist.promotion[0].value.runtimeend}"/> <fmt:formatdate pattern="yyyy-mm-dd" value="${runtimeend}" /> 

p.s. print variable using jstl library, use <c:out value="this printed" /> tag.

scriplets approach:

printing:

 <%=pagecontext.getattribute("runtimeend") %> 

formatting:

<% simpledateformat simpledateformat = new simpledateformat("dd-mm-yyyy");  string converteddate = string.valueof(pagecontext.getattribute("runtimeend")); %> <%=simpledateformat.format(converteddate); %> 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -