Author Login
Post Reply
user Digest 4 Feb 2008 17:06:42 -0000 Issue 7842
Topics (messages 182168 through 182194):
Re: Struts 2. Validation Issue
182168 by: Dave Newton
182169 by: Martin Castellanos
Datetimepicker simple thing doesn't work
java.text.ParseException: Unparseable date: ""
182170 by: Serge Bornow
182171 by: Dave Newton
182172 by: Jeromy Evans
182182 by: Serge Bornow
182183 by: Jeromy Evans
[S2] Multiple buttons in a form
182173 by: hezjing
182175 by: Jeromy Evans
[S2] Action attribute of submit
182174 by: hezjing
182176 by: Jeromy Evans
[OT] Killer Scam
182177 by: Antonio Petrelli
182179 by: Jeromy Evans
182180 by: Don Brown
182181 by: Dave Newton
182186 by: Musachy Barroso
182189 by: Greg Reddin
182191 by: bhaarat Sharma
182193 by: Greg Reddin
extending BasicPreparerFactory
182178 by: mteccles
tomcat can't see french resource bundle
182184 by: wessam
question on mapping
182185 by: Giovanni Azua
182188 by: Jeromy Evans
cannot find catalog?
182187 by: woods5242-grizz.yahoo.com
Re: AjaxTag 1.3 support?
182190 by: Griffith, Michael *
182192 by: Musachy Barroso
182194 by: Musachy Barroso
Administrivia:
---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)
----------------------------------------------------------------------

Attachment:
user_182168.ezm (zipped)--- Martin Castellanos <martincastell@(protected):
> Oh, it's just a regular bean, doesn't implements or extends anything
That'll be an issue.
The workflow interceptor depends on the ValidationAware interface to decide
if it should modify the result.
Dave
> On Feb 3, 2008 12:32 PM, Dave Newton <newton.dave@(protected):
> > --- Martin Castellanos <martincastell@(protected):
> > > Action Class is: com.maca.web.BookAction
> > > Validation file is placed next to the class:
> > BookAction-save-validation.xml
> > > Validation file for the book entity is: Book-validation.xml and it's
> > placed
> > > next to the Book class
> >
> > "Signature" means "How is your class defined?" What does it extend? What
> > does
> > it implement?
> >
> > Dave
> >
> > > On Feb 3, 2008 12:20 PM, Dave Newton <newton.dave@(protected):
> > >
> > > > --- Martin Castellanos <martincastell@(protected):
> > > > > Hi, I'm trying to use the xml validation, the validation is
> > executing
> > > > and
> > > > > detecting errors, but after the validation the method save gets
> > called
> > > > > instead of invoking the input action it's executing the 'success'
> > > > action.
> > > > > I've tried several things but still can't see what's missing, I'm
> > using
> > > > > Spring as the object factory. I'd appreciate any help.
> > > >
> > > > What's the signature of your action class?
> > > >
> > > > Dave
> > > >
> > > > > *
> > > > > *DEBUG [http-8084-4] (ValidationInterceptor.java:134) - Validating
> > > > > /books/save with method save.
> > > > > DEBUG [http-8084-4] (DefaultListableBeanFactory.java:354) - No bean
> > > > named '
> > > > >
com.opensymphony.xwork2.validator.validators.VisitorFieldValidator'
> > > > found
> > > > > in
> > > > >
> > > >
> > > >
> > >
> >
>
org.springframework.beans.factory.support.DefaultListableBeanFactory@(protected)
> > > > :
> > > > > defining beans
> > > > >
> > > >
> > >
> >
> [propertyConfigurer,bookDataSource,bookSessionFactory,bookDao,bookAction];
> > > > > root of factory hierarchy
> > > > > DEBUG [http-8084-4] (CollectionFactory.java:114) - Creating [
> > > > >
java.util.LinkedHashMap]
> > > > > DEBUG [http-8084-4] (AbstractAutowireCapableBeanFactory.java:892) -
> > Not
> > > > > autowiring property 'validatorContext' of bean '
> > > > >
com.opensymphony.xwork2.validator.validators.VisitorFieldValidator'
> > by
> > > > > name:
> > > > > no matching bean found
> > > > > DEBUG [http-8084-4] (AnnotationActionValidatorManager.java:146) -
> > > > Running
> > > > > validator:
> > > > >
> > > >
> > > >
> > >
> >
> >
>
com.opensymphony.xwork2.validator.validators.VisitorFieldValidator@(protected)
> > > > > object
> > > > > com.maca.web.BookAction@(protected)
> > > > > DEBUG [http-8084-4] (DefaultListableBeanFactory.java:354) - No bean
> > > > named '
> > > > >
>
com.opensymphony.xwork2.validator.validators.RequiredStringValidator> > '
> > > > found
> > > > > in
> > > > >
> > > >
> > > >
> > >
> >
>
org.springframework.beans.factory.support.DefaultListableBeanFactory@(protected)
> > > > :
> > > > > defining beans
> > > > >
> > > >
> > >
> >
> [propertyConfigurer,bookDataSource,bookSessionFactory,bookDao,bookAction];
> > > > > root of factory hierarchy
> > > > > DEBUG [http-8084-4] (CollectionFactory.java:114) - Creating [
> > > > >
java.util.LinkedHashMap]
> > > > > DEBUG [http-8084-4] (AbstractAutowireCapableBeanFactory.java:892) -
> > Not
> > > > > autowiring property 'validatorContext' of bean '
> > > > >
>
com.opensymphony.xwork2.validator.validators.RequiredStringValidator> > '
> > > by
> > > > > name: no matching bean found
> > > > > DEBUG [http-8084-4] (DefaultListableBeanFactory.java:354) - No bean
> > > > named '
> > > > >
>
com.opensymphony.xwork2.validator.validators.RequiredStringValidator> > '
> > > > found
> > > > > in
> > > > >
> > > >
> > > >
> > >
> >
>
org.springframework.beans.factory.support.DefaultListableBeanFactory@(protected)
> > > > :
> > > > > defining beans
> > > > >
> > > >
> > >
> >
> [propertyConfigurer,bookDataSource,bookSessionFactory,bookDao,bookAction];
> > > > > root of factory hierarchy
> > > > > DEBUG [http-8084-4] (CollectionFactory.java:114) - Creating [
> > > > >
java.util.LinkedHashMap]
> > > > > DEBUG [http-8084-4] (AbstractAutowireCapableBeanFactory.java:892) -
> > Not
> > > > > autowiring property 'validatorContext' of bean '
> > > > >
>
com.opensymphony.xwork2.validator.validators.RequiredStringValidator> > '
> > > by
> > > > > name: no matching bean found
> > > > > DEBUG [http-8084-4] (AnnotationActionValidatorManager.java:146) -
> > > > Running
> > > > > validator:
> > > > >
> > > >
> > > >
> > >
> >
> >
>
com.opensymphony.xwork2.validator.validators.RequiredStringValidator@(protected)
> > > > > object
> > > > > com.maca.model.Book@(protected)
> > > > > ERROR [http-8084-4] (DelegatingValidatorContext.java:279) -
> > Validation
> > > > > error
> > > > > for book.book.title:Book title is required
> > > > > DEBUG [http-8084-4] (AnnotationActionValidatorManager.java:146) -
> > > > Running
> > > > > validator:
> > > > >
> > > >
> > > >
> > >
> >
> >
>
com.opensymphony.xwork2.validator.validators.RequiredStringValidator@(protected)
> > > > > object
> > > > > com.maca.model.Book@(protected)
> > > > > ERROR [http-8084-4] (DelegatingValidatorContext.java:279) -
> > Validation
> > > > > error
> > > > > for book.book.description:Book description is required
> > > > > DEBUG [http-8084-4] (DefaultActionInvocation.java:383) - Executing
> > > > action
> > > > > method = save
> > > > >
> > > > >
> > > > > This is a snippet from my struts.xml
> > > > >
> > > > > <package name="books" extends="struts-default" namespace="/books">
> > > > >
> > > > > <!-- Default interceptor stack. -->
> > > > > <default-interceptor-ref name="basicStack"/>
> > > > >
> > > > > <action name="list" method="list" class="bookAction">
> > > > > <result>list.jsp</result>
> > > > > </action>
> > > > > <action name="input" method="input" class="bookAction">
> > > > > <result name="success"
> > type="redirect-action">list</result>
> > > > > <result name="input">input.jsp</result>
> > > > > </action>
> > > > > <action name="edit" method="edit" class="bookAction">
> > > > > <result name="success"
> > type="redirect-action">list</result>
> > > > > <result name="input">input.jsp</result>
> > > > > </action>
> > > > > <action name="save" method="save" class="bookAction">
> > > > > <result name="success"
> > type="redirect-action">list</result>
>
=== message truncated ===

Attachment:
user_182169.ezm (zipped)Thanks, I extended DefaultActionSupport and now it's working
On Feb 3, 2008 12:47 PM, Dave Newton <newton.dave@(protected):
> --- Martin Castellanos <martincastell@(protected):
> > Oh, it's just a regular bean, doesn't implements or extends anything
>
> That'll be an issue.
>
> The workflow interceptor depends on the ValidationAware interface to
> decide
> if it should modify the result.
>
> Dave
>
> > On Feb 3, 2008 12:32 PM, Dave Newton <newton.dave@(protected):
> > > --- Martin Castellanos <martincastell@(protected):
> > > > Action Class is: com.maca.web.BookAction
> > > > Validation file is placed next to the class:
> > > BookAction-save-validation.xml
> > > > Validation file for the book entity is: Book-validation.xml and it's
> > > placed
> > > > next to the Book class
> > >
> > > "Signature" means "How is your class defined?" What does it extend?
> What
> > > does
> > > it implement?
> > >
> > > Dave
> > >
> > > > On Feb 3, 2008 12:20 PM, Dave Newton <newton.dave@(protected):
> > > >
> > > > > --- Martin Castellanos <martincastell@(protected):
> > > > > > Hi, I'm trying to use the xml validation, the validation is
> > > executing
> > > > > and
> > > > > > detecting errors, but after the validation the method save gets
> > > called
> > > > > > instead of invoking the input action it's executing the
> 'success'
> > > > > action.
> > > > > > I've tried several things but still can't see what's missing,
> I'm
> > > using
> > > > > > Spring as the object factory. I'd appreciate any help.
> > > > >
> > > > > What's the signature of your action class?
> > > > >
> > > > > Dave
> > > > >
> > > > > > *
> > > > > > *DEBUG [http-8084-4] (ValidationInterceptor.java:134) -
> Validating
> > > > > > /books/save with method save.
> > > > > > DEBUG [http-8084-4] (DefaultListableBeanFactory.java:354) - No
> bean
> > > > > named '
> > > > > >
>
com.opensymphony.xwork2.validator.validators.VisitorFieldValidator'
> > > > > found
> > > > > > in
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>
org.springframework.beans.factory.support.DefaultListableBeanFactory@(protected)
> > > > > :
> > > > > > defining beans
> > > > > >
> > > > >
> > > >
> > >
> >
> [propertyConfigurer,bookDataSource,bookSessionFactory,bookDao,bookAction];
> > > > > > root of factory hierarchy
> > > > > > DEBUG [http-8084-4] (CollectionFactory.java:114) - Creating [
> > > > > >
java.util.LinkedHashMap]
> > > > > > DEBUG [http-8084-4] (AbstractAutowireCapableBeanFactory.java:892)
> -
> > > Not
> > > > > > autowiring property 'validatorContext' of bean '
> > > > > >
>
com.opensymphony.xwork2.validator.validators.VisitorFieldValidator'
> > > by
> > > > > > name:
> > > > > > no matching bean found
> > > > > > DEBUG [http-8084-4] (AnnotationActionValidatorManager.java:146)
> -
> > > > > Running
> > > > > > validator:
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> >
>
>
com.opensymphony.xwork2.validator.validators.VisitorFieldValidator@(protected)
> > > > > > object
> > > > > > com.maca.web.BookAction@(protected)
> > > > > > DEBUG [http-8084-4] (DefaultListableBeanFactory.java:354) - No
> bean
> > > > > named '
> > > > > >
> >
com.opensymphony.xwork2.validator.validators.RequiredStringValidator> > > '
> > > > > found
> > > > > > in
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>
org.springframework.beans.factory.support.DefaultListableBeanFactory@(protected)
> > > > > :
> > > > > > defining beans
> > > > > >
> > > > >
> > > >
> > >
> >
> [propertyConfigurer,bookDataSource,bookSessionFactory,bookDao,bookAction];
> > > > > > root of factory hierarchy
> > > > > > DEBUG [http-8084-4] (CollectionFactory.java:114) - Creating [
> > > > > >
java.util.LinkedHashMap]
> > > > > > DEBUG [http-8084-4] (AbstractAutowireCapableBeanFactory.java:892)
> -
> > > Not
> > > > > > autowiring property 'validatorContext' of bean '
> > > > > >
> >
com.opensymphony.xwork2.validator.validators.RequiredStringValidator> > > '
> > > > by
> > > > > > name: no matching bean found
> > > > > > DEBUG [http-8084-4] (DefaultListableBeanFactory.java:354) - No
> bean
> > > > > named '
> > > > > >
> >
com.opensymphony.xwork2.validator.validators.RequiredStringValidator> > > '
> > > > > found
> > > > > > in
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>
org.springframework.beans.factory.support.DefaultListableBeanFactory@(protected)
> > > > > :
> > > > > > defining beans
> > > > > >
> > > > >
> > > >
> > >
> >
> [propertyConfigurer,bookDataSource,bookSessionFactory,bookDao,bookAction];
> > > > > > root of factory hierarchy
> > > > > > DEBUG [http-8084-4] (CollectionFactory.java:114) - Creating [
> > > > > >
java.util.LinkedHashMap]
> > > > > > DEBUG [http-8084-4] (AbstractAutowireCapableBeanFactory.java:892)
> -
> > > Not
> > > > > > autowiring property 'validatorContext' of bean '
> > > > > >
> >
com.opensymphony.xwork2.validator.validators.RequiredStringValidator> > > '
> > > > by
> > > > > > name: no matching bean found
> > > > > > DEBUG [http-8084-4] (AnnotationActionValidatorManager.java:146)
> -
> > > > > Running
> > > > > > validator:
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> >
>
>
com.opensymphony.xwork2.validator.validators.RequiredStringValidator@(protected)
> > > > > > object
> > > > > > com.maca.model.Book@(protected)
> > > > > > ERROR [http-8084-4] (DelegatingValidatorContext.java:279) -
> > > Validation
> > > > > > error
> > > > > > for book.book.title:Book title is required
> > > > > > DEBUG [http-8084-4] (AnnotationActionValidatorManager.java:146)
> -
> > > > > Running
> > > > > > validator:
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> >
>
>
com.opensymphony.xwork2.validator.validators.RequiredStringValidator@(protected)
> > > > > > object
> > > > > > com.maca.model.Book@(protected)
> > > > > > ERROR [http-8084-4] (DelegatingValidatorContext.java:279) -
> > > Validation
> > > > > > error
> > > > > > for book.book.description:Book description is required
> > > > > > DEBUG [http-8084-4] (DefaultActionInvocation.java:383) -
> Executing
> > > > > action
> > > > > > method = save
> > > > > >
> > > > > >
> > > > > > This is a snippet from my struts.xml
> > > > > >
> > > > > > <package name="books" extends="struts-default"
> namespace="/books">
> > > > > >
> > > > > > <!-- Default interceptor stack. -->
> > > > > > <default-interceptor-ref name="basicStack"/>
> > > > > >
> > > > > > <action name="list" method="list" class="bookAction">
> > > > > > <result>list.jsp</result>
> > > > > > </action>
> > > > > > <action name="input" method="input" class="bookAction">
> > > > > > <result name="success"
> > > type="redirect-action">list</result>
> > > > > > <result name="input">input.jsp</result>
> > > > > > </action>
> > > > > > <action name="edit" method="edit" class="bookAction">
> > > > > > <result name="success"
> > > type="redirect-action">list</result>
> > > > > > <result name="input">input.jsp</result>
> > > > > > </action>
> > > > > > <action name="save" method="save" class="bookAction">
> > > > > > <result name="success"
> > > type="redirect-action">list</result>
> >
> === message truncated ===
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
Martin Castellanos

Attachment:
user_182170.ezm (zipped)Hi All,
I:'ve been battling this for many hours.
I hope someone can help.
Using JDK 1.5, Struts 2.0.11
My property:
shoot_date of type Date
has get and set and on execute()
set's the default date to today's date
setShoot_Date(new Date);
on the form:
<s:datetimepicker name="shoot_date" displayFormat="MM/dd/yyyy" />
even without displayformat it doesn't work.
what happens is that i click the submit button that submits an action
that executes a method that tries to read the shoot_date and it's null.
Hence the error in my log:
java.text.ParseException: Unparseable date: ""
at
java.text.DateFormat.parse (
DateFormat.java:337)
at
org.apache.struts2.components.DateTimePicker.format (
DateTimePicker.java:309)
Does anyone have a good working example?
Thank you very much,
Serge

Attachment:
user_182171.ezm (zipped)I'm not sure what the JavaBean convention would be for a property with an
underscore.
Have you tried it as "shootDate" (with corresponding
getShootDate/setShootDate methods)?
Dave
--- Serge Bornow <serge.bornow@(protected):
> My property:
> shoot_date of type Date
> has get and set and on execute()
> set's the default date to today's date
> setShoot_Date(new Date);
>
> on the form:
> <s:datetimepicker name="shoot_date" displayFormat="MM/dd/yyyy" />
> even without displayformat it doesn't work.
>
> what happens is that i click the submit button that submits an action
> that executes a method that tries to read the shoot_date and it's null.
>
> Hence the error in my log:
>
>
java.text.ParseException: Unparseable date: ""
> at
java.text.DateFormat.parse (
DateFormat.java:337)
> at
>
org.apache.struts2.components.DateTimePicker.format (
DateTimePicker.java:309)
>
>
> Does anyone have a good working example?
>
> Thank you very much,
>
> Serge
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_182172.ezm (zipped)Hi Serge,
You'll find many emails in this forum relating to DatePicker problems.
Some of the solutions are here: http://cwiki.apache.org/S2WIKI/vault.html
In this case though, is it possible you've forgotten the s:head tag at
the top of the page?
Serge Bornow wrote:
> Hi All,
>
> I:'ve been battling this for many hours.
> I hope someone can help.
> Using JDK 1.5, Struts 2.0.11
>
>
> My property:
> shoot_date of type Date
> has get and set and on execute()
> set's the default date to today's date
> setShoot_Date(new Date);
>
> on the form:
> <s:datetimepicker name="shoot_date" displayFormat="MM/dd/yyyy" />
> even without displayformat it doesn't work.
>
> what happens is that i click the submit button that submits an action
> that executes a method that tries to read the shoot_date and it's null.
>
> Hence the error in my log:
>
>
java.text.ParseException: Unparseable date: ""
> at
java.text.DateFormat.parse (
DateFormat.java:337)
> at
>
org.apache.struts2.components.DateTimePicker.format (
DateTimePicker.java:309)
>
>
>
> Does anyone have a good working example?
>
> Thank you very much,
>
> Serge
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>

Attachment:
user_182182.ezm (zipped)Hello Jeromy,
I do have : <s:head theme="simple" />
Also, i use Netbeans to generate respective get/set method so they are
JavaBean std compliant.
The issue for me unfortunately is getting the value back , it seems to
lose it.
:(
Thanks for feedback though.
Serge
Jeromy Evans wrote:
> Hi Serge,
>
> You'll find many emails in this forum relating to DatePicker
> problems. Some of the solutions are here:
> http://cwiki.apache.org/S2WIKI/vault.html
>
> In this case though, is it possible you've forgotten the s:head tag at
> the top of the page?
>
> Serge Bornow wrote:
>> Hi All,
>>
>> I:'ve been battling this for many hours.
>> I hope someone can help.
>> Using JDK 1.5, Struts 2.0.11
>>
>>
>> My property:
>> shoot_date of type Date
>> has get and set and on execute()
>> set's the default date to today's date
>> setShoot_Date(new Date);
>>
>> on the form:
>> <s:datetimepicker name="shoot_date" displayFormat="MM/dd/yyyy" />
>> even without displayformat it doesn't work.
>>
>> what happens is that i click the submit button that submits an action
>> that executes a method that tries to read the shoot_date and it's null.
>>
>> Hence the error in my log:
>>
>>
java.text.ParseException: Unparseable date: ""
>> at
java.text.DateFormat.parse (
DateFormat.java:337)
>> at
>>
org.apache.struts2.components.DateTimePicker.format (
DateTimePicker.java:309)
>>
>>
>>
>> Does anyone have a good working example?
>>
>> Thank you very much,
>>
>> Serge
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

Attachment:
user_182183.ezm (zipped)Here is an example where I use it successfully:
<s:datetimepicker name="incomingAnswer" displayFormat="d MMMM yyyy"
dayWidth="wide" formatLength="full" type="date"
value="%{defaultAnswerDate}"
startDate="%{tomorrowAsRFC3339}"
required="true"/>
but in this specific case defaultAnswerDate, startDate and
incomingAnswer are all String properties whose values are in RFC3339
format ("yyyy-MM-dd").
This doesn't account for the blank error you're experiencing. As Dave
mentioned, the most likely case for that is a property name mismatch.
Serge Bornow wrote:
> Hello Jeromy,
>
> I do have : <s:head theme="simple" />
> Also, i use Netbeans to generate respective get/set method so they are
> JavaBean std compliant.
>
> The issue for me unfortunately is getting the value back , it seems to
> lose it.
> :(
>
> Thanks for feedback though.
>
> Serge
>
> Jeromy Evans wrote:
>> Hi Serge,
>>
>> You'll find many emails in this forum relating to DatePicker
>> problems. Some of the solutions are here:
>> http://cwiki.apache.org/S2WIKI/vault.html
>>
>> In this case though, is it possible you've forgotten the s:head tag
>> at the top of the page?
>>
>> Serge Bornow wrote:
>>> Hi All,
>>>
>>> I:'ve been battling this for many hours.
>>> I hope someone can help.
>>> Using JDK 1.5, Struts 2.0.11
>>>
>>>
>>> My property:
>>> shoot_date of type Date
>>> has get and set and on execute()
>>> set's the default date to today's date
>>> setShoot_Date(new Date);
>>>
>>> on the form:
>>> <s:datetimepicker name="shoot_date" displayFormat="MM/dd/yyyy" />
>>> even without displayformat it doesn't work.
>>>
>>> what happens is that i click the submit button that submits an
>>> action that executes a method that tries to read the shoot_date and
>>> it's null.
>>>
>>> Hence the error in my log:
>>>
>>>
java.text.ParseException: Unparseable date: ""
>>> at
java.text.DateFormat.parse (
DateFormat.java:337)
>>> at
>>>
org.apache.struts2.components.DateTimePicker.format (
DateTimePicker.java:309)
>>>
>>>
>>>
>>> Does anyone have a good working example?
>>>
>>> Thank you very much,
>>>
>>> Serge
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>

Attachment:
user_182173.ezm (zipped)Hi
I have a form with multiple buttons,
<s:form namespace="/user" action="updateUser" method="post">
<s:submit name="action" value="resetPassword" key="button.resetPassword" />
<s:submit name="action" value="delete" key="button.delete" />
</s:form>
and my action class looks like the following,
public String execute() throws Exception {
if (action.equals("resetPassword")) {
userService.resetPassword(user);
} else if (action.equals("delete")) {
userService.delete(user);
}
return SUCCESS;
}
This action is working, except that the label/text of the buttons are
not fetched from the i18n properties file.
The buttons are displayed as "resetPassword" and "delete".
What is the good way to implement a form with multiple buttons, while
maintaining the i18n?
--
Hez

Attachment:
user_182175.ezm (zipped)
hezjing wrote:
> Hi
>
> I have a form with multiple buttons,
>
> <s:form namespace="/user" action="updateUser" method="post">
> <s:submit name="action" value="resetPassword" key="button.resetPassword" />
> <s:submit name="action" value="delete" key="button.delete" />
> </s:form>
>
>
> and my action class looks like the following,
>
> public String execute() throws Exception {
> if (action.equals("resetPassword")) {
> userService.resetPassword(user);
> } else if (action.equals("delete")) {
> userService.delete(user);
> }
> return SUCCESS;
> }
>
>
> This action is working, except that the label/text of the buttons are
> not fetched from the i18n properties file.
>
> The buttons are displayed as "resetPassword" and "delete".
>
>
I don't see why the I18N isn't working. That's probably just a minor
configuration problem.
> What is the good way to implement a form with multiple buttons, while
> maintaining the i18n?
>
>
>
Several options:
on s:submit, include a method="" attribute to call a method other than
execute
<s:submit name="action" value="resetPassword" key="button.resetPassword" method="reset"/>
<s:submit name="action" value="delete" key="button.delete" method="delete />
public String reset() throws Exception {
userService.resetPassword(user);
return SUCCESS;
}
public String delete() throws Exception {
userService.delete(user);
return SUCCESS;
}
---
Or split it into two actions:
<s:submit name="action" value="resetPassword" key="button.resetPassword" action="resetPassword"/>
<s:submit name="action" value="delete" key="button.delete" action="deleteUser/>
---
Or use a wildcard in the action
<s:submit name="action" value="resetPassword" key="button.resetPassword" action="updateUserReset"/>
<s:submit name="action" value="delete" key="button.delete" action="updateUserDelete/>
<action name="updateUser*" method="{1}" class="...">
---
I prefer the latter approach because it works best with XML validation and the ajax tags.

Attachment:
user_182174.ezm (zipped)Hi
In http://struts.apache.org/2.0.11/docs/submit.html, the submit tag
has an "action" attribute that says "set action attribute."
May I know how can we make use of this action attribute?
Any example?
Thank you!
--
Hez

Attachment:
user_182176.ezm (zipped)hezjing wrote:
> Hi
>
> In http://struts.apache.org/2.0.11/docs/submit.html, the submit tag
> has an "action" attribute that says "set action attribute."
>
> May I know how can we make use of this action attribute?
> Any example?
>
> Thank you!
>
>
>
It simply overrides the action attribute of the form:
<s:submit name="submit" value="a" action="action1"/>
<s:submit name="submit" value="a" action="action2"/>
where action1 and action2 are actions named in struts.xml
The way it works is that the value of the button has the name of the
action added to it. The ActionMap in struts2 inspects the params,
detects the "action:" prefix and executes the named action instead of
the one in the URL. The prefix is then stripped off the value.
The method attribute works the same way (adds a method: prefix)

Attachment:
user_182177.ezm (zipped)I received an email scam in my apache.org email that is,
substantially, the first in this list:
http://www.scamorama.com/killer.html
Did you receive such a letter?
Antonio

Attachment:
user_182179.ezm (zipped)Hi Antonio, I received that spam for the first time today too on my
address used on this list. I guess it just went wild.
Antonio Petrelli wrote:
> I received an email scam in my apache.org email that is,
> substantially, the first in this list:
> http://www.scamorama.com/killer.html
>
> Did you receive such a letter?
>
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>
>

Attachment:
user_182180.ezm (zipped)Aw, I just thought I was special, and was so excited - my first death threat! :)
Don
On Feb 4, 2008 9:54 PM, Jeromy Evans <jeromy.evans@(protected):
> Hi Antonio, I received that spam for the first time today too on my
> address used on this list. I guess it just went wild.
>
>
> Antonio Petrelli wrote:
> > I received an email scam in my apache.org email that is,
> > substantially, the first in this list:
> > http://www.scamorama.com/killer.html
> >
> > Did you receive such a letter?
> >
> > Antonio
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_182181.ezm (zipped)--- Antonio Petrelli <antonio.petrelli@(protected):
> I received an email scam in my apache.org email that is,
> substantially, the first in this list:
> http://www.scamorama.com/killer.html
>
> Did you receive such a letter?
I got one this morning.
Of course, I'm a pretty skilled knife- and stick-fighter and have fairly
current firearm and bodyguard training, so I was more eager than anything
else :D
If you get any background information on whoever sent it, please send it my
way; I don't have the time to dig at the moment.
Dave

Attachment:
user_182186.ezm (zipped)oh I was just reading it. Struts 2 team, you are going down! :)
musachy
On Feb 4, 2008 7:06 AM, Dave Newton <newton.dave@(protected):
> --- Antonio Petrelli <antonio.petrelli@(protected):
> > I received an email scam in my apache.org email that is,
> > substantially, the first in this list:
> > http://www.scamorama.com/killer.html
> >
> > Did you receive such a letter?
>
> I got one this morning.
>
> Of course, I'm a pretty skilled knife- and stick-fighter and have fairly
> current firearm and bodyguard training, so I was more eager than anything
> else :D
>
> If you get any background information on whoever sent it, please send it my
> way; I don't have the time to dig at the moment.
>
> Dave
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment:
user_182189.ezm (zipped)On Feb 4, 2008 4:47 AM, Antonio Petrelli <antonio.petrelli@(protected):
> I received an email scam in my apache.org email that is,
> substantially, the first in this list:
> http://www.scamorama.com/killer.html
>
> Did you receive such a letter?
Yep, I got one. Somebody don't like Tiles I guess :-)
Greg

Attachment:
user_182191.ezm (zipped)I didnt get it. or maybe i deleted it already.
Anyone wana paste what it read?
On 2/4/08, Greg Reddin <gredbug@(protected):
On Feb 4, 2008 4:47 AM, Antonio Petrelli <antonio.petrelli@(protected):
> > I received an email scam in my apache.org email that is,
> > substantially, the first in this list:
> > http://www.scamorama.com/killer.html
> >
> > Did you receive such a letter?
>
> Yep, I got one. Somebody don\'t like Tiles I guess :-)
>
> Greg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_182193.ezm (zipped)On Feb 4, 2008 11:00 AM, bhaarat Sharma <bhaarat.s@(protected):
> I didnt get it. or maybe i deleted it already.
>
> Anyone wana paste what it read?
Antonio's post had the link:
http://www.scamorama.com/killer.html
Maybe you should be worried if you didn't get one :-)
Greg

Attachment:
user_182178.ezm (zipped)
Hi,
I found the DTD for tiles configuration at
http://struts.apache.org/struts-sandbox/tiles/tiles-core/dtddoc/index.html.
What I want to do is extend the BasicPreparerFactory and configure the
struts 2 application to use my class. The application uses the spring plugin
but tiles 2 is sandbox and does not integrate with spring yet. Therefore I
need to manage the instantiation of preparer classes in a custom factory
that behaves like the spring container.
Somewhere in struts.xml or tiles.xml this can be configured???
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_182184.ezm (zipped)
i've a strange problem
my application is done with struts, working local with JDeveloper IDE which
has OC4J embedded server
when i change locale to french local the labels are read correctly
but when i deploy on tomcat labels from resource bundle are read in english
though labels are retrieved from database are read in french normally which
means that local is set to french
any sugesstions please ?
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_182185.ezm (zipped)hi,
Suppose you have a struts.xml mapping that looks like:
<action name="Form*"
class="com.sag.optimizer.ui.web.action.form.Form{1}Action">
<result name="input" type="tiles">webui.form{1}</result>
<result name="error" type="tiles">webui.failed</result>
</action>
In several cases I will probably want to provide a valid non empty
implementation of a corresponding Form{1}Action.class but in some cases
I don't want to have to provide any but a default implementation e.g.
FormGenericAction that just extends ActionSupport. Is there any way to
do that?
My coverage reports are getting uglier and this is one of the reasons :)
regards,
Giovanni

Attachment:
user_182188.ezm (zipped)Will CodeBehind give what you need? I'm not sure with your use of
wildcards.
It gives "pages with no mapping": a default do-nothing action that
provides access to s2 tags & resources...but not to a default tile AFAIK
http://struts.apache.org/2.0.11/docs/codebehind-plugin.html
Giovanni Azua wrote:
> hi,
>
> Suppose you have a struts.xml mapping that looks like:
>
> <action name="Form*"
> class="com.sag.optimizer.ui.web.action.form.Form{1}Action">
> <result name="input" type="tiles">webui.form{1}</result>
> <result name="error" type="tiles">webui.failed</result>
> </action>
> In several cases I will probably want to provide a valid non empty
> implementation of a corresponding Form{1}Action.class but in some
> cases I don't want to have to provide any but a default implementation
> e.g. FormGenericAction that just extends ActionSupport. Is there any
> way to do that?
>
> My coverage reports are getting uglier and this is one of the reasons :)
>
> regards,
> Giovanni
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>

Attachment:
user_182187.ezm (zipped)
Attachment:
user_182190.ezm (zipped)Jeromy,
Again, thanks for the reply. I appreciate your help!
Following your example below, I can see the JSON result in the app
server console when the action called, but I get the following error in
the browser:
FATAL exception raised: TypeError: Value undefined (result of expression
this.data[x][0].toLowerCase) is not object.
What is this telling me?
-- my Struts mapping:
<package name="search" extends="json-default"
namespace="/search">
<action name="searchByText"
class="...QuestionSearchAction">
<result name="success" type="json">
<param name="root">list</param>
</result>
</action>
</package>
-- My Form:
<s:url id="search" namespace="/search" value="/searchByText.action" />
<s:autocompleter theme="ajax" href="%{search}" name="text"
loadOnTextChange="true" loadMinimumCount="3"/>
-- My Action:
public class QuestionSearchAction extends BaseAction {
/**
*
*/
private static final long serialVersionUID =
1127012585409657094L;
Question[] list;
private QuestionService questionService;
public void setQuestionService(QuestionService questionService)
{
this.questionService = questionService;
}
public String execute() {
List<Question> all= questionService.getQuestions();
list= all.toArray( new Question[all.size()]);
return SUCCESS;
}
public Question[] getList(){
return list;
}
}
Cheers!
mg
-----Original Message-----
From: Jeromy Evans [mailto:jeromy.evans@(protected)]
Sent: Saturday, February 02, 2008 6:15 PM
To: Struts Users Mailing List
Subject: Re: AjaxTag 1.3 support?
I completely agree with Dave so I'll take a different tact.
Based on this example:
http://struts.apache.org/2.0.11/docs/ajax-tags.html#AjaxTags-autocomplet
erTag,
I would also take the approach of returning a JSON Result via the JSON
Plugin. Only the configuration changes for an XML result.
So, my form looks like this:
<s:url id="json" value="/JSONList.action" />
<s:autocompleter theme="ajax" href="%{json}" dropdownHeight="180"/>
So, my struts.xml contains the corresponding action definition with a
JSON result:
<package name="example" extends="json-default">
<action name="JSONList" class="package.ListAction">
<result name="success" type="json">
<param name="root">list</param>
</result>
</action>
</package>
And my action method looks like this:
private ACEntry[] list;
public String execute() {
list = populateList()
return "success";
}
public ACEntry[] getList() {
return list;
}
---
In summary, the autocompleter does a get to /JSONList.action
Struts2 executes the execute method of ListAction
The execute method creates a structure that will populate the
autocompleter
The action returns a JSON result type
The JSON plugin converts the root object (the list property only rather
than the whole action) to a JSON structure
The JSON plugin returns the application/json content to the
autocompleter
I'll leave it to you to determine what the list structure should like
like. As it'll probably be re-use I'd create a bean for the purpose.
Use the FireBug plugin for firefox to inspect the format of the JSON
result to ensure it matches the format required by the javascript
library (or even better, write a unit test).
This will work with any javascript library that accepts JSON - you just
have to provide an appropriate structure. It will also work with any
library that requires an XML response, except you'd use an XML result
type like I previously described in this thread.
I hope that helps. Struts2 is really well suited at providing non-html
responses if you take the time to understand the ResultType
architecture.
cheers,
Jeromy Evans
Dave Newton wrote:
> --- "Griffith, Michael *" <Michael.Griffith@(protected):
>
>> Thanks for the comprehensive reply. Looking at the documentation and
the
>> example app, I am still not sure how to configure my action/response.
I
>> am using tiles 2.
>>
>
> As previously stated if you are writing directly to the response you
need to
> return null from the action. I am still not sure why you're using a
tile
> definition here.
>
>
>
>> It seems I need to return my result in JSON format correct? By
returning
>> a JSON String from the action, how to I configure my response?
>>
>
> As Jeremy said this is, however, probably a bad idea, considering that
the
> same outcome can be achieved in several different ways.
>
> Using a JSON result will serialize your action to JSON automagically.
You'd
> use a "json" result (via the JSON plugin), not a tile. Or you could
build the
> JSON manually and configure a FreeMarker result.
>
>
>> If I use the tiles response type, I get a dojo parsing error because
the
>> whole page is returned from the reply.
>>
>
> Sure.
>
>
>> The example in the example app isn't very clear to me, as the action
>> returns a .JS file with the result hard coded, and not using any
>> template like tiles I might add.
>>
>
> What example are you referring to?
>
>
http://struts.apache.org/2.0.11/docs/ajax-tags.html#AjaxTags-autocomplet
erTag?
>
> When making an Ajax request for a component like <s:autocompleter.../>
it's
> unlikely you'd want to return anything other than JSON. (Other
components or
> component libraries may want other formats like XML or whatever.)
Unless your
> tile definition is creating JSON it's not going to work, and it's
unlikely
> that would be the best way to generate the JSON anyway.
>
>
>> Also, I think I found a bug? -- the namespace attribute seems to be
>> ignored when I pass href=%{search} to the autocompleter. I had to put
>> qualify the namespace in the value to get the correct action to be
>> invoked.
>>
>
> When you configure the package does your namespace have a leading "/"
(slash)
> character? If it doesn't this can lead to dispatching issues.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

Attachment:
user_182192.ezm (zipped)sorry to be late to this discussion. Dave and Jeromy are right on the
spot. I would advise not to use ajaxtags project and go with what
Struts 2 provides, or use YUI which will play nicely with JSON.
musachy
On Feb 4, 2008 11:57 AM, Griffith, Michael *
<Michael.Griffith@(protected):
> Jeromy,
>
> Again, thanks for the reply. I appreciate your help!
>
> Following your example below, I can see the JSON result in the app
> server console when the action called, but I get the following error in
> the browser:
>
> FATAL exception raised: TypeError: Value undefined (result of expression
> this.data[x][0].toLowerCase) is not object.
>
> What is this telling me?
>
> -- my Struts mapping:
> <package name="search" extends="json-default"
> namespace="/search">
> <action name="searchByText"
> class="...QuestionSearchAction">
> <result name="success" type="json">
> <param name="root">list</param>
> </result>
> </action>
> </package>
>
> -- My Form:
> <s:url id="search" namespace="/search" value="/searchByText.action" />
> <s:autocompleter theme="ajax" href="%{search}" name="text"
> loadOnTextChange="true" loadMinimumCount="3"/>
>
>
> -- My Action:
> public class QuestionSearchAction extends BaseAction {
>
> /**
> *
> */
> private static final long serialVersionUID =
> 1127012585409657094L;
>
> Question[] list;
> private QuestionService questionService;
>
> public void setQuestionService(QuestionService questionService)
> {
> this.questionService = questionService;
> }
>
> public String execute() {
> List<Question> all= questionService.getQuestions();
> list= all.toArray( new Question[all.size()]);
> return SUCCESS;
> }
>
> public Question[] getList(){
> return list;
> }
>
> }
>
>
> Cheers!
> mg
>
> -----Original Message-----
> From: Jeromy Evans [mailto:jeromy.evans@(protected)]
> Sent: Saturday, February 02, 2008 6:15 PM
> To: Struts Users Mailing List
> Subject: Re: AjaxTag 1.3 support?
>
>
> I completely agree with Dave so I'll take a different tact.
>
> Based on this example:
> http://struts.apache.org/2.0.11/docs/ajax-tags.html#AjaxTags-autocomplet
> erTag,
> I would also take the approach of returning a JSON Result via the JSON
> Plugin. Only the configuration changes for an XML result.
>
> So, my form looks like this:
>
> <s:url id="json" value="/JSONList.action" />
> <s:autocompleter theme="ajax" href="%{json}" dropdownHeight="180"/>
>
> So, my struts.xml contains the corresponding action definition with a
> JSON result:
>
> <package name="example" extends="json-default">
> <action name="JSONList" class="package.ListAction">
> <result name="success" type="json">
> <param name="root">list</param>
> </result>
> </action>
> </package>
>
> And my action method looks like this:
>
> private ACEntry[] list;
>
> public String execute() {
> list = populateList()
> return "success";
> }
>
> public ACEntry[] getList() {
> return list;
> }
>
> ---
> In summary, the autocompleter does a get to /JSONList.action
> Struts2 executes the execute method of ListAction
> The execute method creates a structure that will populate the
> autocompleter
> The action returns a JSON result type
> The JSON plugin converts the root object (the list property only rather
> than the whole action) to a JSON structure
> The JSON plugin returns the application/json content to the
> autocompleter
>
> I'll leave it to you to determine what the list structure should like
> like. As it'll probably be re-use I'd create a bean for the purpose.
> Use the FireBug plugin for firefox to inspect the format of the JSON
> result to ensure it matches the format required by the javascript
> library (or even better, write a unit test).
> This will work with any javascript library that accepts JSON - you just
> have to provide an appropriate structure. It will also work with any
> library that requires an XML response, except you'd use an XML result
> type like I previously described in this thread.
>
> I hope that helps. Struts2 is really well suited at providing non-html
> responses if you take the time to understand the ResultType
> architecture.
>
> cheers,
> Jeromy Evans
>
> Dave Newton wrote:
> > --- "Griffith, Michael *" <Michael.Griffith@(protected):
> >
> >> Thanks for the comprehensive reply. Looking at the documentation and
> the
> >> example app, I am still not sure how to configure my action/response.
> I
> >> am using tiles 2.
> >>
> >
> > As previously stated if you are writing directly to the response you
> need to
> > return null from the action. I am still not sure why you're using a
> tile
> > definition here.
> >
> >
> >
> >> It seems I need to return my result in JSON format correct? By
> returning
> >> a JSON String from the action, how to I configure my response?
> >>
> >
> > As Jeremy said this is, however, probably a bad idea, considering that
> the
> > same outcome can be achieved in several different ways.
> >
> > Using a JSON result will serialize your action to JSON automagically.
> You'd
> > use a "json" result (via the JSON plugin), not a tile. Or you could
> build the
> > JSON manually and configure a FreeMarker result.
> >
> >
> >> If I use the tiles response type, I get a dojo parsing error because
> the
> >> whole page is returned from the reply.
> >>
> >
> > Sure.
> >
> >
> >> The example in the example app isn't very clear to me, as the action
> >> returns a .JS file with the result hard coded, and not using any
> >> template like tiles I might add.
> >>
> >
> > What example are you referring to?
> >
> >
> http://struts.apache.org/2.0.11/docs/ajax-tags.html#AjaxTags-autocomplet
> erTag?
> >
> > When making an Ajax request for a component like <s:autocompleter.../>
> it's
> > unlikely you'd want to return anything other than JSON. (Other
> components or
> > component libraries may want other formats like XML or whatever.)
> Unless your
> > tile definition is creating JSON it's not going to work, and it's
> unlikely
> > that would be the best way to generate the JSON anyway.
> >
> >
> >> Also, I think I found a bug? -- the namespace attribute seems to be
> >> ignored when I pass href=%{search} to the autocompleter. I had to put
> >> qualify the namespace in the value to get the correct action to be
> >> invoked.
> >>
> >
> > When you configure the package does your namespace have a leading "/"
> (slash)
> > character? If it doesn't this can lead to dispatching issues.
> >
> > Dave
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment:
user_182194.ezm (zipped)I think that error is coming from your jsp, not the JSON generation.
Do you have "this.data[x][0].toLowerCase" somewhere?
musachy
On Feb 4, 2008 11:57 AM, Griffith, Michael *
<Michael.Griffith@(protected):
> Jeromy,
>
> Again, thanks for the reply. I appreciate your help!
>
> Following your example below, I can see the JSON result in the app
> server console when the action called, but I get the following error in
> the browser:
>
> FATAL exception raised: TypeError: Value undefined (result of expression
> this.data[x][0].toLowerCase) is not object.
>
> What is this telling me?
>
> -- my Struts mapping:
> <package name="search" extends="json-default"
> namespace="/search">
> <action name="searchByText"
> class="...QuestionSearchAction">
> <result name="success" type="json">
> <param name="root">list</param>
> </result>
> </action>
> </package>
>
> -- My Form:
> <s:url id="search" namespace="/search" value="/searchByText.action" />
> <s:autocompleter theme="ajax" href="%{search}" name="text"
> loadOnTextChange="true" loadMinimumCount="3"/>
>
>
> -- My Action:
> public class QuestionSearchAction extends BaseAction {
>
> /**
> *
> */
> private static final long serialVersionUID =
> 1127012585409657094L;
>
> Question[] list;
> private QuestionService questionService;
>
> public void setQuestionService(QuestionService questionService)
> {
> this.questionService = questionService;
> }
>
> public String execute() {
> List<Question> all= questionService.getQuestions();
> list= all.toArray( new Question[all.size()]);
> return SUCCESS;
> }
>
> public Question[] getList(){
> return list;
> }
>
> }
>
>
> Cheers!
> mg
>
> -----Original Message-----
> From: Jeromy Evans [mailto:jeromy.evans@(protected)]
> Sent: Saturday, February 02, 2008 6:15 PM
> To: Struts Users Mailing List
> Subject: Re: AjaxTag 1.3 support?
>
>
> I completely agree with Dave so I'll take a different tact.
>
> Based on this example:
> http://struts.apache.org/2.0.11/docs/ajax-tags.html#AjaxTags-autocomplet
> erTag,
> I would also take the approach of returning a JSON Result via the JSON
> Plugin. Only the configuration changes for an XML result.
>
> So, my form looks like this:
>
> <s:url id="json" value="/JSONList.action" />
> <s:autocompleter theme="ajax" href="%{json}" dropdownHeight="180"/>
>
> So, my struts.xml contains the corresponding action definition with a
> JSON result:
>
> <package name="example" extends="json-default">
> <action name="JSONList" class="package.ListAction">
> <result name="success" type="json">
> <param name="root">list</param>
> </result>
> </action>
> </package>
>
> And my action method looks like this:
>
> private ACEntry[] list;
>
> public String execute() {
> list = populateList()
> return "success";
> }
>
> public ACEntry[] getList() {
> return list;
> }
>
> ---
> In summary, the autocompleter does a get to /JSONList.action
> Struts2 executes the execute method of ListAction
> The execute method creates a structure that will populate the
> autocompleter
> The action returns a JSON result type
> The JSON plugin converts the root object (the list property only rather
> than the whole action) to a JSON structure
> The JSON plugin returns the application/json content to the
> autocompleter
>
> I'll leave it to you to determine what the list structure should like
> like. As it'll probably be re-use I'd create a bean for the purpose.
> Use the FireBug plugin for firefox to inspect the format of the JSON
> result to ensure it matches the format required by the javascript
> library (or even better, write a unit test).
> This will work with any javascript library that accepts JSON - you just
> have to provide an appropriate structure. It will also work with any
> library that requires an XML response, except you'd use an XML result
> type like I previously described in this thread.
>
> I hope that helps. Struts2 is really well suited at providing non-html
> responses if you take the time to understand the ResultType
> architecture.
>
> cheers,
> Jeromy Evans
>
> Dave Newton wrote:
> > --- "Griffith, Michael *" <Michael.Griffith@(protected):
> >
> >> Thanks for the comprehensive reply. Looking at the documentation and
> the
> >> example app, I am still not sure how to configure my action/response.
> I
> >> am using tiles 2.
> >>
> >
> > As previously stated if you are writing directly to the response you
> need to
> > return null from the action. I am still not sure why you're using a
> tile
> > definition here.
> >
> >
> >
> >> It seems I need to return my result in JSON format correct? By
> returning
> >> a JSON String from the action, how to I configure my response?
> >>
> >
> > As Jeremy said this is, however, probably a bad idea, considering that
> the
> > same outcome can be achieved in several different ways.
> >
> > Using a JSON result will serialize your action to JSON automagically.
> You'd
> > use a "json" result (via the JSON plugin), not a tile. Or you could
> build the
> > JSON manually and configure a FreeMarker result.
> >
> >
> >> If I use the tiles response type, I get a dojo parsing error because
> the
> >> whole page is returned from the reply.
> >>
> >
> > Sure.
> >
> >
> >> The example in the example app isn't very clear to me, as the action
> >> returns a .JS file with the result hard coded, and not using any
> >> template like tiles I might add.
> >>
> >
> > What example are you referring to?
> >
> >
> http://struts.apache.org/2.0.11/docs/ajax-tags.html#AjaxTags-autocomplet
> erTag?
> >
> > When making an Ajax request for a component like <s:autocompleter.../>
> it's
> > unlikely you'd want to return anything other than JSON. (Other
> components or
> > component libraries may want other formats like XML or whatever.)
> Unless your
> > tile definition is creating JSON it's not going to work, and it's
> unlikely
> > that would be the best way to generate the JSON anyway.
> >
> >
> >> Also, I think I found a bug? -- the namespace attribute seems to be
> >> ignored when I pass href=%{search} to the autocompleter. I had to put
> >> qualify the namespace in the value to get the correct action to be
> >> invoked.
> >>
> >
> > When you configure the package does your namespace have a leading "/"
> (slash)
> > character? If it doesn't this can lead to dispatching issues.
> >
> > Dave
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd