You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by longhao <wi...@gmail.com> on 2007/04/24 13:19:41 UTC

Null date become today in map when use textfield tag

 TestDateAction.java
public class TestDateAction extends ActionSupport {

	private Date singleDate;
	private Map mapDate;
	private List listDate;
		
	@Override
	public String execute() throws Exception {
		
		return super.execute();
		
	}

	....set get methods
}


index.jsp

....jsp tag input
<form action="testDate.action">
<s:textfield name="mapDate['today']"/>
<s:textfield name="singleDate"/>
<s:textfield name="listDate[0]"/>
<input type="submit"/>
<form>

struts.xml
	<package name="default" extends="struts-default">
		<action name="testDate" class="testDate">
			<result name="success">index.jsp</result>
		</action>
	</package>

I input nothing in all three textfield then submit.
In TestDateAction three parameters are all null in valuestack.
But after come back to index.jsp, mapDate['today'] 's value become today. so magic.
The Null date value become today in Textfield tag. Perhaps this is a bug of ognl when use textfield. 




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Null date become today in map when use textfield tag

Posted by Dave Newton <ne...@yahoo.com>.
--- Martin Gainty <mg...@hotmail.com> wrote:
> please supply the applicationContext.xml definition
> for 'testDate'

Huh?

I'd be more likely to think it has something to do
with not using the <s:form.../> tag, but I've never
been entirely sure what the relationship between it
and the input tags really is.

d.

> 
> e.g. web..xml
>   <action name="springExample" class="springAction">
>    <result name="success">
>     /WEB-INF/view/springExample.jsp
>    </result>
>   </action>
> 
> <beans default-autowire="autodetect">
>  <bean id="thingManager"
>  
>
class="org.apache.struts2.portlet.example.spring.ThingManager">
>  </bean>
>  <bean id="springAction"
>  
>
class="org.apache.struts2.portlet.example.spring.SpringAction"
> 
> singleton="false">
>   <property name="thingManager">
>    <ref bean="thingManager" />
>   </property>
>  </bean>
> </beans>
> 
> M-
> This email message and any files transmitted with it
> contain confidential
> information intended only for the person(s) to whom
> this email message is
> addressed.  If you have received this email message
> in error, please notify
> the sender immediately by telephone or email and
> destroy the original
> message without making a copy.  Thank you.
> 
> ----- Original Message ----- 
> From: "longhao" <wi...@gmail.com>
> To: "Struts Users Mailing List"
> <us...@struts.apache.org>
> Sent: Tuesday, April 24, 2007 7:19 AM
> Subject: Null date become today in map when use
> textfield tag
> 
> 
> > TestDateAction.java
> > public class TestDateAction extends ActionSupport
> {
> >
> > private Date singleDate;
> > private Map mapDate;
> > private List listDate;
> >
> > @Override
> > public String execute() throws Exception {
> >
> > return super.execute();
> >
> > }
> >
> > ....set get methods
> > }
> >
> >
> > index.jsp
> >
> > ....jsp tag input
> > <form action="testDate.action">
> > <s:textfield name="mapDate['today']"/>
> > <s:textfield name="singleDate"/>
> > <s:textfield name="listDate[0]"/>
> > <input type="submit"/>
> > <form>
> >
> > struts.xml
> > <package name="default" extends="struts-default">
> > <action name="testDate" class="testDate">
> > <result name="success">index.jsp</result>
> > </action>
> > </package>
> >
> > I input nothing in all three textfield then
> submit.
> > In TestDateAction three parameters are all null in
> valuestack.
> > But after come back to index.jsp, mapDate['today']
> 's value become today. 
> > so magic.
> > The Null date value become today in Textfield tag.
> Perhaps this is a bug 
> > of ognl when use textfield.
> >
> >
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> >
> > 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Null date become today in map when use textfield tag

Posted by Martin Gainty <mg...@hotmail.com>.
please supply the applicationContext.xml definition for 'testDate'

e.g. web..xml
  <action name="springExample" class="springAction">
   <result name="success">
    /WEB-INF/view/springExample.jsp
   </result>
  </action>

<beans default-autowire="autodetect">
 <bean id="thingManager"
  class="org.apache.struts2.portlet.example.spring.ThingManager">
 </bean>
 <bean id="springAction"
  class="org.apache.struts2.portlet.example.spring.SpringAction" 
singleton="false">
  <property name="thingManager">
   <ref bean="thingManager" />
  </property>
 </bean>
</beans>

M-
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- 
From: "longhao" <wi...@gmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Tuesday, April 24, 2007 7:19 AM
Subject: Null date become today in map when use textfield tag


> TestDateAction.java
> public class TestDateAction extends ActionSupport {
>
> private Date singleDate;
> private Map mapDate;
> private List listDate;
>
> @Override
> public String execute() throws Exception {
>
> return super.execute();
>
> }
>
> ....set get methods
> }
>
>
> index.jsp
>
> ....jsp tag input
> <form action="testDate.action">
> <s:textfield name="mapDate['today']"/>
> <s:textfield name="singleDate"/>
> <s:textfield name="listDate[0]"/>
> <input type="submit"/>
> <form>
>
> struts.xml
> <package name="default" extends="struts-default">
> <action name="testDate" class="testDate">
> <result name="success">index.jsp</result>
> </action>
> </package>
>
> I input nothing in all three textfield then submit.
> In TestDateAction three parameters are all null in valuestack.
> But after come back to index.jsp, mapDate['today'] 's value become today. 
> so magic.
> The Null date value become today in Textfield tag. Perhaps this is a bug 
> of ognl when use textfield.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org