This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "issue with datetimepicker & autocompleter in struts 2 " Watch "issue with datetimepicker & autocompleter in struts 2 " New topic

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.

Pawan Kalyan

galne vaibhav

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


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

David Newton

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

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.


I agree. Here's the link:
subject: issue with datetimepicker & autocompleter in struts 2
jQuery in Action, 3rd edition