Struts2- Date Flicker Example
AIM:
To perform Date Flicker using Struts2 and Netbean6.8 IDE.
Procedure:
There are four steps to create this example
Step 1:
Create Action
Step 2:
Create jsp files
Step 3:
Made changes in struts.xml
Step 4:
Run the file
Step 1:
Create action Named as (DateFlickerPro)
Already you have known how to create action-using netbean.
And include following coding into the DateFlickerPro
package example;
import java.util.Date;
import com.opensymphony.xwork2.ActionSupport;
public class DateBean extends ActionSupport
{
private Date todate;
public Date getTodate()
{
return todate;
}
public void setTodate(Date todate)
{
this.todate = todate;
}
public DateBean()
{
}
public String execute() throws Exception
{
setTodate(new Date());
return "success";
}
}
Step 2:
Create jsp files.
Create index.jsp
Include following coding into index.jsp
< %@taglib uri="/struts-tags" prefix="s" % >
< html >
< head >
< title > Date FlickerExample < /title >
< s:head theme="ajax"/ >
< /head >
< body >
< s:datetimepicker name="todate" label="Format (yyyy-MM-dd)" displayFormat="yyyy-MM-dd"/ >
< s:datetimepicker name="todate" label="Format (dd-MMM-yyyy)" displayFormat="dd-MMM-yyyy"/ >
< /body >
< /html >
Step 3:
Made some change in struts.xml
< !DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
http://struts.apache.org/dtds/struts-2.0.dtd >
< struts >
< package name="example" namespace="/example" extends="struts-default" >
< action name="FormDate" class="example.DateBean" >
< result name="success" > /example/index.jsp < /result >
< /action >
< /package >
< /struts >
Step 4:
Run the index.jsp
You get output like below
No comments:
Post a Comment