Pages

Wednesday, 11 September 2013

Struts 2 datetimepicker Example

Let us see how to work with this datetimepicker in struts 2, actually no need to add any external jar files to work with this,  some of us may think we need to add some Ajax related jars bla bla…,  let me clear

jars required

  • commons-logging-1.0.4.jar
  • freemarker-2.3.8.jar
  • ognl-2.6.11.jar
  • struts2-core-2.0.11.jar
  • xwork-2.0.4.jar
Let us see one example, files required
  • index.jsp
  • success.jsp
  • web.xml
  • struts.xml
  • LogingEx.java

Directory Structure

index.jsp

success.jsp

LogingEx.java

web.xml

struts.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
    <include file="struts-default.xml"/>
    <package name="a" extends="struts-default">
        <action name="resultAction" class="java4s.LogingEx">
            <result name="success">/success.jsp</result>
            <result name="error">/error.jsp</result>
        </action>
    </package>
</struts>

No comments:

Post a Comment