You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Giovanni Azua <gi...@imc.nl> on 2007/11/14 11:24:15 UTC
S2.1.1 sx:datetimepicker seem to ignore displayFormat on submit
hi,
In version 2.0.9 I had a datetimepicker with custom user-defined
conversion that worked fine. After migrating
to S 2.1.1 my conversion class on submit receives the beginDate in the
wrong format, instead of the expected
"yyyy.MM.dd" I get something like dd-MM-yyyyT<time part>.
Seems like a defect new to 2.1.1 or?
Thanks in advance,
Best regards,
Giovanni
****************************** formSimulationRun.jsp *********************
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<s:form action="SimulationRun.action" method="post" theme="%{currentTheme}">
<sx:datetimepicker label="Begin Date" name="beginDate"
displayFormat="yyyy.MM.dd" toggleType="fade"
toggleDuration="500" />
...
<s:submit value="Simulate" align="center"/>
</s:form>
*********************** SimulationRunAction-conversion.properties
***********************
beginDate=com.sag.optimizer.ui.web.support.StringToDateConverter
endDate=com.sag.optimizer.ui.web.support.StringToDateConverter
*********************** StringToDateConverter.java
************************************
/**
* Custom conversion used by e.g. Simulation input form.
*
* @author <a href="mailto:giaz@imc.nl">Giovanni Azua</a>
* @version $ $Date: Oct 3, 2007 1:27:13 PM $
*/
public
class StringToDateConverter
extends StrutsTypeConverter
{
//------------------------------------------------------------------------
// public
//------------------------------------------------------------------------
@Override
public Object
convertFromString(Map aMap, String[] anArguments, Class aClass)
{
if (anArguments.length != 1)
{
super.performFallbackConversion(aMap, anArguments, aClass);
}
Integer myDate =
Integer.valueOf(anArguments[0].replaceAll("\\.", ""));
return myDate;
}
//------------------------------------------------------------------------
/**
* @throws UnsupportedOperationException "Not yet implemented."
*/
@Override
public String
convertToString(Map aMap, Object anArgument)
{
throws UnsupportedOperationException("Not yet implemented.");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: S2.1.1 sx:datetimepicker seem to ignore displayFormat on submit
Posted by Giovanni Azua <gi...@imc.nl>.
hi,
Ok good to know! thanks!
We need a special integer-based format and not Date but this makes the
conversion actually simpler.
Thanks!
Best regards,
Giovanni
Musachy Barroso wrote:
> Actually it was wrong in 2.0.x, on 2.1 the date will always be
> submitted as RFC 3339, if you define your field as a Date, or a
> Calendar object you won't have to do any conversion at all.
>
> musachy
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: S2.1.1 sx:datetimepicker seem to ignore displayFormat on submit
Posted by Musachy Barroso <mu...@gmail.com>.
Actually it was wrong in 2.0.x, on 2.1 the date will always be
submitted as RFC 3339, if you define your field as a Date, or a
Calendar object you won't have to do any conversion at all.
musachy
On Nov 14, 2007 5:24 AM, Giovanni Azua <gi...@imc.nl> wrote:
> hi,
>
> In version 2.0.9 I had a datetimepicker with custom user-defined
> conversion that worked fine. After migrating
> to S 2.1.1 my conversion class on submit receives the beginDate in the
> wrong format, instead of the expected
> "yyyy.MM.dd" I get something like dd-MM-yyyyT<time part>.
>
> Seems like a defect new to 2.1.1 or?
>
> Thanks in advance,
> Best regards,
> Giovanni
>
> ****************************** formSimulationRun.jsp *********************
>
> <%@ page contentType="text/html; charset=UTF-8"%>
> <%@ taglib prefix="s" uri="/struts-tags"%>
> <%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
>
> <s:form action="SimulationRun.action" method="post" theme="%{currentTheme}">
> <sx:datetimepicker label="Begin Date" name="beginDate"
> displayFormat="yyyy.MM.dd" toggleType="fade"
> toggleDuration="500" />
> ...
> <s:submit value="Simulate" align="center"/>
> </s:form>
>
> *********************** SimulationRunAction-conversion.properties
> ***********************
>
> beginDate=com.sag.optimizer.ui.web.support.StringToDateConverter
> endDate=com.sag.optimizer.ui.web.support.StringToDateConverter
>
> *********************** StringToDateConverter.java
> ************************************
>
> /**
> * Custom conversion used by e.g. Simulation input form.
> *
> * @author <a href="mailto:giaz@imc.nl">Giovanni Azua</a>
> * @version $ $Date: Oct 3, 2007 1:27:13 PM $
> */
> public
> class StringToDateConverter
> extends StrutsTypeConverter
> {
>
> //------------------------------------------------------------------------
> // public
>
> //------------------------------------------------------------------------
> @Override
> public Object
> convertFromString(Map aMap, String[] anArguments, Class aClass)
> {
> if (anArguments.length != 1)
> {
> super.performFallbackConversion(aMap, anArguments, aClass);
> }
> Integer myDate =
> Integer.valueOf(anArguments[0].replaceAll("\\.", ""));
>
> return myDate;
> }
>
>
> //------------------------------------------------------------------------
> /**
> * @throws UnsupportedOperationException "Not yet implemented."
> */
> @Override
> public String
> convertToString(Map aMap, Object anArgument)
> {
> throws UnsupportedOperationException("Not yet implemented.");
> }
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org