Hi Ankur,

I'm just surprised, that the text field is populated when I hit reload. Somehow 
I had expected that if the text field name matches an action bean property that 
it will be populated automatically - or it would be populated never, except if 
I submit the form with errors… 

I did not configure the population strategy, so I assume 
DefaultPopulationStrategy will be effective. The documentation reads: "If there 
is no value in the request then an ActionBean bound to the current form will be 
looked for". That's the part I don't understand, because I assumed that the 
action bean would be used to populate the text field. 

-Moritz

Am 23.02.2012 um 04:59 schrieb Ankur Sharda:

> Hi Moritz,
> 
> What is the behaviour you want. Do you want the date to be displayed in the 
> text field, if so you just have to do    <s:text id="date" name="date" 
> formatPattern="dd.MM.yyyy" value="${actionBean.date}" />
> 
> But I suspect you already know that, and are asking about something else?
> 
> 
> 
> On Thu, Feb 23, 2012 at 5:26 AM, Moritz Petersen <moritz.peter...@gmail.com> 
> wrote:
> Hello,
> 
> I found a strange bug in my application and I'm not sure what the root cause 
> could be.
> 
> There is an index.jsp file, which redirects to my action bean:
> 
> <c:redirect url="/app/note" />
> 
> The Stripes Dispatcher Servlet is mapped to /app/* (from web.xml):
> 
>  <servlet-mapping>
>    <servlet-name>DispatcherServlet</servlet-name>
>    <url-pattern>/app/*</url-pattern>
>  </servlet-mapping>
> 
> So, I believe with this redirect, the action bean should be called:
> 
> @UrlBinding( "/app/note/{$event}/{note.meetingId}/{note.id}" )
> public class NoteActionBean extends AbstractActionBean {
>    private Date date;
> 
>    @DefaultHandler
>    public Resolution create() {
>        // set the date to new Date()
>        // return ForwardResolution to "note.jsp"
>    }
> 
> // getter and setter
> ...
> }
> 
> The note.jsp page itself displays the form:
> 
>  <s:form beanclass="NoteActionBean" method="post" id="noteEntry">
>    <!-- ${actionBean.date} -->
>    <s:text id="date" name="date" formatPattern="dd.MM.yyyy" />
> ...
> 
> 
> But the rendered HTML is:
> 
> <form id="noteEntry" action="/app/note;jsessionid=h100dcmd5xs8" method="post">
> <!-- Wed Feb 22 21:20:24 UTC 2012 -->
> <input id="date" name="date" type="text" />
> ...
> 
> 
> So, there is no date in the text field. But in the comment before it is! And 
> when debugging, I found out that the method getDate() is not called from the 
> text field.
> 
> On the other hand, when I reload the page (without doing anything else) the 
> field shows the date correctly.
> 
> I'm a bit lost here. What am I doing wrong?
> 
> Any suggestions are highly appreciated. Thank you.
> 
> Moritz.
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
> 
> 
> 
> -- 
> Ankur Sharda
> E: ankurshard...@gmail.com
> M: 0421 311 106
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing 
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/_______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to