File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes issue with datetimepicker & autocompleter in struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "issue with datetimepicker & autocompleter in struts 2 " Watch "issue with datetimepicker & autocompleter in struts 2 " New topic
Author

issue with datetimepicker & autocompleter in struts 2

Pawan Kalyan
Ranch Hand

Joined: Jun 18, 2009
Posts: 34
Hi All,

I am currently working on an application with Struts2 and stuck up in 2 issues .

1) Issue with datetimepicker tag:

I have a date field in my jsp with the below syntax.

<sx:datetimepicker name="incidentdate" label="Incident Date" displayFormat="MM-dd-yyyy"/>

And the action class has the same field Date incidentdate; ( with getters and setter methods as well)

When I am selecting a date from the datetimepicker tag and trying to submit, i am getting a pop up error message " [Ojbect Error]".



2) Issue with autocompleter tag


I am using an autocompleter tag to select a reason, but I want to make this as a mandatory field, but when i am writing validation rule then i am getting the same error message "[Object Error]".

<sx:autocompleter name="issue" label="Issue" list="{'Login','Help','New Request','Edit request'}" autoComplete="true" showDownArrow="false" />

So can someone help me how to get these things fixed.

I want to select a date from datetimepicker and be able to submit my form
and able to validate the autocompleter tag and make sure that the user should not be able to leave that empty.


Thanks,
Pawan Kalyan

galne vaibhav
Greenhorn

Joined: Nov 30, 2009
Posts: 9
hi you have to follow simple steps




functions gfnDisableKeys() and gfnDisableControls() are optional that is written for not allow any char other than date







action code







reply if your prblem not rsolved


take care of this things:
NOTE-you need to specify head tag like this i gusss your problem resolve when you do this

<head>
<title>l</title>
<s:head/>
<sx:head/>
</head>


and you need to add struts2-dojo-plugin-2.1.6.jar to your application.

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please don't quote your own text--it's a bit misleading, and unnecessarily difficult to read.
Pawan Kalyan
Ranch Hand

Joined: Jun 18, 2009
Posts: 34
Hey.

It seems that the date filed in my action class should be as a String.
And its getting in the format as "2009-12-01T00:00:00-05:00"

I need that in MM/dd/yyyy format.
I am doing a simpledate format but receiving java.text.ParseException: Unparseable date: "2009-12-01"

I am using :

String temp=inc.substring(0,10);
SimpleDateFormat sdfOutput = new SimpleDateFormat ( "yyyy/MM/dd" ) ;
Date date = (Date) sdfOutput.parse (temp) ;

Can someone help me in this.


Thanks,
pawan

Thanks.
Pawan
 
 
subject: issue with datetimepicker & autocompleter in struts 2