Wednesday, June 25, 2014

Date Format from jsp page

Add below these line in head tag : 
 <!-- start for date format -->
<%@page import="java.util.Date" %>
<%@page import="java.text.DateFormat" %>
<%@page import="java.text.SimpleDateFormat" %>
<%
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
String formattedDate = df.format(new Date());
%>
<!-- end for date format -->




Start Date Format from  jsp  page:
<input  id="schoolDate" name="schoolDate" type="text"  value="<s:property value='institutes.establish_date'/>" placeholder="DD/MM/YYYY"  maxlength="10" size="10" style="height:26px;text-transform: lowercase;font-variant: small-caps; font-size:14px;" class="form-control input-sm"/>


<input  id="schoolDate" name="schoolDate" type="text"  value="<s:date name='institutes.establish_date' format='dd/MM/yyyy'  />" placeholder="DD/MM/YYYY"  maxlength="10" size="10" style="height:26px;text-transform: lowercase;font-variant: small-caps; font-size:14px;" class="form-control input-sm"/>




value="<s:property value='institutes.establish_date'/>"
value="<s:date name='institutes.establish_date' format='dd/MM/yyyy'  />"


Also see the below  Link :
http://www.java-connect.com/jsp/how-to-use-scriptlets-in-jsp-page.html

No comments:

Post a Comment