Results 1 to 4 of 4
Thread: Need Help on jQuery and Struts2
- 04-09-2010, 05:47 PM #1
Member
- Join Date
- Apr 2010
- Location
- Vadodara
- Posts
- 7
- Rep Power
- 0
Need Help on jQuery and Struts2
Hello ,
I am working with Struts2 and jQuery.
But I am able to add the Jquery datePicker widget with My Project.
and Code Snap shot and Structure of the Wen-Content is as Follow :
Directory Sructure for the Project is as Follows :
Web-Content
--images //it Contains Required Images.
--js //contins js of jquery.
----jquery-1.4.2.min.js
----jquery-ui-1.8.custom.min.js
--META-INF
--theme
----... //Contins jquery control ui css.
--ui
----jquery.ui.core.js
----jquery.ui.datepicker.js
----jquery.ui.widget.js
--WEB-INF
----classes
-------... //contains required action classes .class and validation.xml
-------srtuts.xml
----LIB // Contains required libraries by Struts2 Framework
----SRC // Source code for Class Files .java files
----web.xmml
--index.jsp
--other jsp pages are here
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="sx" uri="/struts-dojo-tags" %>
<html>
<head>
<sx:head/>
<meta charset="UTF-8" />
<title>jQuery UI Tabs - Default functionality</title>
<link type="text/css" href="theme/jquery.ui.all.css" rel="stylesheet" />
<link type="text/css" href="theme/jquery-ui-1.8.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<SCRIPT type="text/javascript" src="js/jquery-ui-1.8.custom.min.js"></SCRIPT>
<script type="text/javascript" src="ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="ui/jquery.ui.datepicker.js"></script>
<script type="text/javascript">
$(function() {
$("#datepicker").datepicker();
});
</script>
</head>
<body>
<s:form action="HelloTest">
<s:textfield name="firstName" label="Enter Your Name Here : " />
<s:submit/>
<!--This Struts2 DOJO Control to Select Date.-->
<s:datetimepicker cssStyle="width:300px;" type="date" iconPath="images/calendar.gif" label="Date" displayFormat="dd/MMM/yyyy"> </s:datetimepicker>
</s:form>
<s:form>
<!--Adding jQyery datetimecotrol Control To text area-->
<s:textfield cssClass="datepicker" > </s:textfield>
</s:form>
</body>
</html>
- 04-12-2010, 05:50 PM #2
Member
- Join Date
- Dec 2009
- Location
- Germany
- Posts
- 43
- Rep Power
- 0
You reference in your JavaScript Code to an Element with an Id datepicker.
But your textfield has no Id.
You have 3 Options:
1. Give your Textfield an Id
2. Change your JavaScript formJava Code:<s:textfield id="datepicker" cssClass="datepicker" > </s:textfield>
toJava Code:$("#datepicker").datepicker();
Java Code:$(".datepicker").datepicker();
3. Use the Datepicker Component form Struts2 jQuery Plugin
I hope this helps you out
- 04-17-2010, 01:58 PM #3
Member
- Join Date
- Apr 2010
- Location
- Vadodara
- Posts
- 7
- Rep Power
- 0
HI jogep,
I got the Problem Solved
Thanks a Lot For that.
and Can you give me some good example of Struts2 with Validation
- 04-18-2010, 11:08 AM #4
Member
- Join Date
- Dec 2009
- Location
- Germany
- Posts
- 43
- Rep Power
- 0
you can find many examples in the struts2 docs.
Validation with XML
Struts2 Validation
Annotation based Validation
Struts2 Validation with Annotations
Best Regards
Johannes Geppert
Similar Threads
-
Struts2 jQuery Plugin
By jogep in forum Java SoftwareReplies: 7Last Post: 01-25-2011, 08:43 PM -
struts2 with jquery
By amma2009 in forum Advanced JavaReplies: 10Last Post: 11-16-2010, 09:07 AM -
Need JQuery PDF Tutorials
By vinothkumarrvk in forum Web FrameworksReplies: 1Last Post: 04-09-2010, 05:47 PM -
Need JQuery PDF Tutorials
By vinothkumarrvk in forum Forum GuidesReplies: 0Last Post: 03-05-2010, 03:22 PM -
jQuery 1.2.1
By JavaBean in forum Java SoftwareReplies: 0Last Post: 10-25-2007, 04:21 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks