Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 31 Jan 2008 18:25:11 -0000 Issue 7835

user-digest-help

2008-01-31


Author LoginPost Reply

user Digest 31 Jan 2008 18:25:11 -0000 Issue 7835

Topics (messages 182015 through 182042):

Re: [S2.1] dojo widget dialog
 182015 by: Desbois Arnaud

Please help me in Coding
 182016 by: ihaveareason
 182017 by: Antonio Petrelli
 182018 by: Mark McLaren
 182026 by: Martin Gainty

Re: dojo script for DATEPICKER tag
 182019 by: Naveen Kumar M
 182020 by: ravi_eze

Re: Type converters: please help!!! :(
 182021 by: ravi_eze

Re: Type converters: convertToString not called
 182022 by: ravi_eze
 182023 by: ravi_eze
 182024 by: ravi_eze

[S2] problems with validations
 182025 by: Juan Carlos Serrano

Re: #request scope
 182027 by: Dave Newton

preparable vs modelDriven
 182028 by: Adam Hardy
 182029 by: Dave Newton
 182031 by: Adam Hardy
 182032 by: Dave Newton
 182033 by: Adam Hardy
 182038 by: Roberto Nunnari
 182040 by: Musachy Barroso
 182041 by: Dave Newton

Response/Session pattern for this use-case?
 182030 by: Giovanni Azua

ServletActionRedirectResult issue
 182034 by: Luis Gervaso
 182035 by: Luis Gervaso
 182037 by: Dave Newton
 182042 by: Luis Gervaso

PO Question about Struts2
 182036 by: issueTracker
 182039 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_182015.ezm (zipped)
It's work with <sx:head debug="true" parseContent="true" />

But you need also to move the dojo.require("dojo.widget.Dialog") into the init function.

Thanks.

-----Message d'origine-----
De : Jeromy Evans [mailto:jeromy.evans@(protected)]
Envoyé : jeudi 31 janvier 2008 07:56
À : Struts Users Mailing List
Objet : Re: [S2.1] dojo widget dialog

Your code likes fine so it appears that dojo has not parsed the html for
widgets.
I think there's an attribute on sx:head to enable this in Struts2.1
(parseContent=true or something like that)

Desbois Arnaud wrote:
> I'm using Struts 2.1.0, and I want to use the dojo widget dialog.
>
>
>
> I try this simple code:
>
> <%@(protected)" %>
>
> <html>
>
> <head>
>
> <sx:head debug="true"/>
>
> <script type="text/javascript">
>
> dojo.require("dojo.widget.Dialog");
>
> var dlg;
>
> function init() {
>
>  dlg = dojo.widget.byId("dialogContent");
>
>  dojo.debug("dlg="+dlg);
>
>  alert(dlg+" "+document.getElementById("dialogContent"));
>
> }
>
> dojo.addOnLoad(init);
>
> </script>
>
> </head>
>
>
>
> <body>
>
> <a href="javascript:dlg.show()">Show</a>
>
> <div dojoType="Dialog" id="dialogContent" bgColor="grey" bgOpacity="0.5"
> toggle="fade" toggleDuration="250" closeOnBackgroundClick="true">
>
> Hello World!
>
> </div>
>
> </body>
>
> </html>
>
>
>
> But the variable dlg is always undefined (but with the
> document.getElementById("dialogContent"), the div is correctly present)
>
>
>
> How I can correctly use the widget dialog into Struts 2.1.0 ?
>
>
>
> Best regards
>
> Arnaud
>
>
>
>
>  
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.15/1249 - Release Date: 29/01/2008 9:51 AM
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


Attachment: user_182016.ezm (zipped)

Hi,
Any one please help in coding i have to bring CSV(comma separated values)
datas through struts.I can able to run java file successfully,but iam
getting errors in Struts.xml. Here by i pasted the java file and Struts.xml.
Please help me its urgent. http://www.nabble.com/file/p15200971/Stock.java
Stock.java http://www.nabble.com/file/p15200971/struts.xml struts.xml
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_182017.ezm (zipped)
2008/1/31, ihaveareason <srivats08@(protected)>:
>
>
> Hi,
> Any one please help in coding i have to bring CSV(comma separated values)
> datas through struts.I can able to run java file successfully,but iam
> getting errors in Struts.xml. Here by i pasted the java file and
> Struts.xml.
> Please help me its urgent. http://www.nabble.com/file/p15200971/Stock.java
> Stock.java http://www.nabble.com/file/p15200971/struts.xml struts.xml



We are not here to make your homework.

Antonio

Attachment: user_182018.ezm (zipped)
You could try:

<http://sourceforge.net/projects/csv4j/>

I'm sure there are many such CSV related utilities out there.

Mark

On Jan 31, 2008 9:32 AM, Antonio Petrelli <antonio.petrelli@(protected):
> 2008/1/31, ihaveareason <srivats08@(protected)>:
> >
> >
> > Hi,
> > Any one please help in coding i have to bring CSV(comma separated values)
> > datas through struts.I can able to run java file successfully,but iam
> > getting errors in Struts.xml. Here by i pasted the java file and
> > Struts.xml.
> > Please help me its urgent. http://www.nabble.com/file/p15200971/Stock.java
> > Stock.java http://www.nabble.com/file/p15200971/struts.xml struts.xml
>
>
>
> We are not here to make your homework.
>
> Antonio
>



--
"Paradoxically, the more time saving abstractions you are using the
more you actually have to know." - Simon Willison

Attachment: user_182026.ezm (zipped)
Good Morning

can you display or attach the following files?
your working copy of Struts2HelloWorld.java
your working copy of HelloWorld.jsp
your working copy of login.jsp
your working copy of loginsuccess.jsp
your working copy of ControlTagsIf.jsf

Thanks
M-
----- Original Message -----
From: "ihaveareason" <srivats08@(protected)>
To: <user@(protected)>
Sent: Thursday, January 31, 2008 4:29 AM
Subject: Please help me in Coding


>
> Hi,
> Any one please help in coding i have to bring CSV(comma separated values)
> datas through struts.I can able to run java file successfully,but iam
> getting errors in Struts.xml. Here by i pasted the java file and
Struts.xml.
> Please help me its urgent. http://www.nabble.com/file/p15200971/Stock.java
> Stock.java http://www.nabble.com/file/p15200971/struts.xml struts.xml
> --
> View this message in context:
http://www.nabble.com/Please-help-me-in-Coding-tp15200971p15200971.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


Attachment: user_182019.ezm (zipped)

THANKS Wannemacher FOR YOUR REPLY.

My question is, I want to change the values being assigned the
startDate and endDate parameters for the tag. So for example
page using my datepicker is loaded in to browser today, than
startDate should be todays systems date, for the same in next
coming day the startDate should be that day's system date(server date)

I hope i have posted my question more clearly.

Expecting some response on the issue.


Regards,
Minchu



Wes Wannemacher <wesw@(protected)
received an error?

http://struts.apache.org/2.x/docs/datetimepicker.html

-Wes

On Thu, 2008-01-31 at 05:24 +0000, Naveen Kumar M wrote:
> Hi,
>
> We have a reqierment to control startdate and enddate of the datepicker dynamically, so i have tried out for controlling it by a dojo script, which is breaking up the appearance of datepicker. So can any one suggest how to control it dyanimcally.
>
> thanks in advance
>
>
> regards,
> minchu
>
>    
> ---------------------------------
> Unlimited freedom, unlimited storage. Get it now


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)



   
---------------------------------
5, 50, 500, 5000 - Store N number of mails in your inbox. Click here.

Attachment: user_182020.ezm (zipped)

hi,

if i am uderstanding u right then this should solve ur problem.

action class:
Date inpDate = new Date();

jsp page:
<s:datetimepicker name="inpDate" ... />

so for the fist time when the page is being displayed the inpDate is set ot
the current date which will solve ur problem

hope this helps.

cheers,
ravi


Naveen Kumar M wrote:
>
>
> THANKS Wannemacher FOR YOUR REPLY.
>
> My question is, I want to change the values being assigned the
> startDate and endDate parameters for the tag. So for example
> page using my datepicker is loaded in to browser today, than
> startDate should be todays systems date, for the same in next
> coming day the startDate should be that day's system date(server date)
>
> I hope i have posted my question more clearly.
>
> Expecting some response on the issue.
>
>
> Regards,
> Minchu
>
>
>
> Wes Wannemacher <wesw@(protected)
> endDate parameters for the tag and
> received an error?
>
> http://struts.apache.org/2.x/docs/datetimepicker.html
>
> -Wes
>
> On Thu, 2008-01-31 at 05:24 +0000, Naveen Kumar M wrote:
>> Hi,
>>
>> We have a reqierment to control startdate and enddate of the datepicker
>> dynamically, so i have tried out for controlling it by a dojo script,
>> which is breaking up the appearance of datepicker. So can any one suggest
>> how to control it dyanimcally.
>>
>> thanks in advance
>>
>>
>> regards,
>> minchu
>>
>>    
>> ---------------------------------
>> Unlimited freedom, unlimited storage. Get it now
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>    
> ---------------------------------
> 5, 50, 500, 5000 - Store N number of mails in your inbox. Click here.
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_182021.ezm (zipped)

any help?

had any one encountered a similar situation.

i am pasting thelink straight to the problem so that u need not navigate
throught the discussion threads to locate it.

http://www.nabble.com/Type-converters%3A-convertToString-not-called-to15034925.html

any help would be great.

regards,
ravi

ravi_eze wrote:
>
> hi,
> The code is as follows. Do not get terrified by the length of the post. I
> tried formatting the post for better readability. Hope this helps you...
> to help me ;)
>
> @new.xml, this is included in struts.xml
> <struts>
>  <package name="newsCreation" namespace="/new"
>    extends="struts-default">
>
>    <action name="configurenew"
>      class="com.comp.admin.news.newConfigurationAction"
>      method="viewnew">
>      <interceptor-ref name="scope">
>        < param name="session">
>          newData,disableFields
>        < /param>
>      </interceptor-ref>
>      <interceptor-ref name="conversionError" />
>      <interceptor-ref name="params" />
>      <result>/new/layout/newConfiguration_layout.jsp</result>
>      <result name="input">
>        /new/layout/new_layout.jsp
>      </result>
>    </action>
>
> @com\comp\admin\news\newConfigurationAction-conversion.properties
> newData.maxLimit=com.comp.util.converter.newLongConverter
> ...
>
> @com.comp.util.converter.newLongConverter
> public class newLongConverter extends StrutsTypeConverter {
>
>  public Object convertFromString(Map context, String[] values, Class
> toClass) {
>    if (null == values || values.length == 0 || values[0]==null ||
> values[0].trim().length()==0 )
>      return 0;
>    try {
>      int i = Integer.parseInt(values[0]);
>      return i;
>    } catch (Exception ex) {}
>    return 0;
>  }
>  public String convertToString(Map context, Object obj) {
>    if (null == obj)
>      return "0";
>    if(obj instanceof Long)
>      return ((Long)obj).longValue()+"";
>    return "";
>  }
> }
>
>
>
>
> mgainty wrote:
>>
>> Hi Ravi-
>>
>> Could you display your code for your StrutsTypeConverter class please
>>
>> M-
>> ----- Original Message -----
>> From: "ravi_eze" <ravichandrac@(protected)>
>> To: <user@(protected)>
>> Sent: Friday, January 25, 2008 12:58 AM
>> Subject: RE: Type converters: please help!!! :(
>>
>>
>>>
>>> Thank you Jeff for the reply.
>>>
>>> did u mean the *converter* attribute of the action tag that we give in
>>> struts.xml? I didnt give any such attribute in it. I added
>>> ActionClass-conversion.properties: in which i mentioned the attribute to
>>> pickup a class which implements convertFromString and viceversa
>>> functions.
>>>
>>> My action tag in the xml are as follows:
>>>
>>> <struts>
>>> <package name="eventsCreation" namespace="/event"
>>> extends="struts-default">
>>>
>>> <interceptors>
>>> <interceptor name="..." class="..." />
>>> <interceptor name="..." class="..." />
>>> </interceptors>
>>>
>>> <action name="oneAct" class="oneClass">
>>> <interceptor-ref name="...">
>>> ...
>>> </interceptor-ref>
>>> <result>one.jsp</result>
>>> </action>
>>> ...
>>>
>>> let me know if you are looking for anything else.
>>>
>>> cheers,
>>> ravi
>>>
>>>
>>> Jeff Hill (RR) wrote:
>>> >
>>> > Ravi,
>>> > From my understanding of OGNL, it *should* use the model object's
>>> > conversion
>>> > descriptor. It's probably more surprising that it called
>> convertFromString
>>> > without it. Are you using defaultStack?
>>> >
>>> > I believe providing the model object's descriptor is the correct
>> approach,
>>> > and you indicate that it's working. So why the long face? ;-)
>>> >
>>> > -----Original Message-----
>>> > From: ravi_eze [mailto:ravichandrac@(protected)]
>>> > Sent: Thursday, January 24, 2008 11:45 PM
>>> > To: user@(protected)
>>> > Subject: Type converters: please help!!! :(
>>> >
>>> >
>>> > hi,
>>> >
>>> > i badly need the solution to this problem. i had posted this issue on
>>> > xwork
>>> > forums, struts fourms previously also, but hardluck: no reply :(
>>> >
>>> > i am reposting the same again... atleast let me know if this idea
>>> itself
>>> > is
>>> > wrong!!! or any better approach/ is there?
>>> >
>>> >
>>> > ravi_eze wrote:
>>> >>
>>> >> hi,
>>> >>
>>> >> We have Action class with Employee Object with setters and getters.
>>> The
>>> >> Typeconverter was configured to be called when <EmployeeObject.empId>
>> is
>>> >> called by the jsp page. We found that convertFromString of type
>> converter
>>> >> is being called but convertToString is never called. Any idea why
>>> this
>> is
>>> >> happening? The details are as follows:
>>> >>
>>> >> Type converter:
>>> >> public class LongConverter extends StrutsTypeConverter {
>>> >> public Object convertFromString(Map context, String[] values, Class
>>> >> toClass) {
>>> >>       ... ....
>>> >> }
>>> >> public String convertToString(Map context, Object o) {
>>> >>      ... ....
>>> >> }
>>> >> }
>>> >>
>>> >> in actionClass-conversion.properties located along with the class
>>> file
>> in
>>> >> the same package:
>>> >> employee.empId=com.comp.util.converter.LongConverter
>>> >>
>>> >> After some debugging we found that we need to add a new file:
>>> >> Employee-conversion.properties in the same package of Employee class
>> with
>>> >> entries:
>>> >> empId=com.comp.util.converter.LongConverter
>>> >>
>>> >> and only then the convertToString would be called. I think we should
>> have
>>> >> only one conversion.prop file instead of 2. Any ideas why this is
>>> >> happening this way? or am i missing any thing? please help.
>>> >>
>>> >> cheers,
>>> >> ravi
>>> >>
>>> >
>>> > --
>>> > View this message in context:
>>> >
>> http://www.nabble.com/Type-converters%3A-convertToString-not-called-tp150349
>>> > 25p15080943.html
>>> > Sent from the Struts - User mailing list archive at Nabble.com.
>>> >
>>> >
>>> > ---------------------------------------------------------------------
>>> > 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)
>>> >
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>> http://www.nabble.com/Type-converters%3A-convertToString-not-called-tp150349
>> 25p15081469.html
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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)
>>
>>
>>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_182022.ezm (zipped)

hi,

thanks for the reply. If the design had this behavior intended then probably
we cannot do any thing.... but in that case i would not agree with the
design. I read the post linked below and also the bug... but still unable to
understand the reason behind for such a design.

i think i will now have to redesign my application.

thanks for all your help

regards,
ravi


jimski wrote:
>
> Hi Ravi-
>
> I think the problem here is how the struts2 tags were implemented. As far
> as I can see from the code base the type converter definition you're
> referring to is used by the XWork API and not OGNL. The XWork api is used
> by the Struts Tags which have the option to call the converter or not. In
> the case of rendering content, the option chosen by the designers is not
> to call the converter and call toString() instead. Check out this bug
> report https://issues.apache.org/struts/browse/WW-2047 for more details.
>
> I asked a question about this:
> (http://www.nabble.com/Struts-framework-design-question%3A-Type-Converters-and-Tags-to15019888.html)
>
> ...and it seems like a community generated patch is probably the only way
> forward at this point. I started looking into it, but my day job has been
> way too busy to give me any time to actually code a patch. There's also a
> question on my part as to whether or not the patch would even be accepted
> given that 2.0.6 supported type conversion at render time and the core
> struts2 dev team has explicitly chosen to remove this feature (as
> mentioned by Don Brown in the referenced bug report).
>
>
> ravi_eze wrote:
>>
>> hi,
>>
>> We have Action class with Employee Object with setters and getters. The
>> Typeconverter was configured to be called when <EmployeeObject.empId> is
>> called by the jsp page. We found that convertFromString of type converter
>> is being called but convertToString is never called. Any idea why this is
>> happening? The details are as follows:
>>
>> Type converter:
>> public class LongConverter extends StrutsTypeConverter {
>>  public Object convertFromString(Map context, String[] values, Class
>> toClass) {
>>       ... ....
>>  }
>>  public String convertToString(Map context, Object o) {
>>      ... ....
>>  }
>> }
>>
>> in actionClass-conversion.properties located along with the class file in
>> the same package:
>> employee.empId=com.comp.util.converter.LongConverter
>>
>> After some debugging we found that we need to add a new file:
>> Employee-conversion.properties in the same package of Employee class with
>> entries:
>> empId=com.comp.util.converter.LongConverter
>>
>> and only then the convertToString would be called. I think we should have
>> only one conversion.prop file instead of 2. Any ideas why this is
>> happening this way? or am i missing any thing? please help.
>>
>> cheers,
>> ravi
>>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_182023.ezm (zipped)

hi,

thanks for the reply. If the design had this behavior intended then probably
we cannot do any thing.... but in that case i would not agree with the
design. I read the post linked below and also the bug... but still unable to
understand the reason behind for such a design.

i think i will now have to redesign my application.

thanks for all your help

regards,
ravi


jimski wrote:
>
> Hi Ravi-
>
> I think the problem here is how the struts2 tags were implemented. As far
> as I can see from the code base the type converter definition you're
> referring to is used by the XWork API and not OGNL. The XWork api is used
> by the Struts Tags which have the option to call the converter or not. In
> the case of rendering content, the option chosen by the designers is not
> to call the converter and call toString() instead. Check out this bug
> report https://issues.apache.org/struts/browse/WW-2047 for more details.
>
> I asked a question about this:
> (http://www.nabble.com/Struts-framework-design-question%3A-Type-Converters-and-Tags-to15019888.html)
>
> ...and it seems like a community generated patch is probably the only way
> forward at this point. I started looking into it, but my day job has been
> way too busy to give me any time to actually code a patch. There's also a
> question on my part as to whether or not the patch would even be accepted
> given that 2.0.6 supported type conversion at render time and the core
> struts2 dev team has explicitly chosen to remove this feature (as
> mentioned by Don Brown in the referenced bug report).
>
>
> ravi_eze wrote:
>>
>> hi,
>>
>> We have Action class with Employee Object with setters and getters. The
>> Typeconverter was configured to be called when <EmployeeObject.empId> is
>> called by the jsp page. We found that convertFromString of type converter
>> is being called but convertToString is never called. Any idea why this is
>> happening? The details are as follows:
>>
>> Type converter:
>> public class LongConverter extends StrutsTypeConverter {
>>  public Object convertFromString(Map context, String[] values, Class
>> toClass) {
>>       ... ....
>>  }
>>  public String convertToString(Map context, Object o) {
>>      ... ....
>>  }
>> }
>>
>> in actionClass-conversion.properties located along with the class file in
>> the same package:
>> employee.empId=com.comp.util.converter.LongConverter
>>
>> After some debugging we found that we need to add a new file:
>> Employee-conversion.properties in the same package of Employee class with
>> entries:
>> empId=com.comp.util.converter.LongConverter
>>
>> and only then the convertToString would be called. I think we should have
>> only one conversion.prop file instead of 2. Any ideas why this is
>> happening this way? or am i missing any thing? please help.
>>
>> cheers,
>> ravi
>>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_182024.ezm (zipped)

one more thing, then when would this method be called?? sounds like
redundant.



ravi_eze wrote:
>
> hi,
>
> thanks for the reply. If the design had this behavior intended then
> probably we cannot do any thing.... but in that case i would not agree
> with the design. I read the post linked below and also the bug... but
> still unable to understand the reason behind for such a design.
>
> i think i will now have to redesign my application.
>
> thanks for all your help
>
> regards,
> ravi
>
>
> jimski wrote:
>>
>> Hi Ravi-
>>
>> I think the problem here is how the struts2 tags were implemented. As
>> far as I can see from the code base the type converter definition you're
>> referring to is used by the XWork API and not OGNL. The XWork api is
>> used by the Struts Tags which have the option to call the converter or
>> not. In the case of rendering content, the option chosen by the
>> designers is not to call the converter and call toString() instead.
>> Check out this bug report https://issues.apache.org/struts/browse/WW-2047
>> for more details.
>>
>> I asked a question about this:
>> (http://www.nabble.com/Struts-framework-design-question%3A-Type-Converters-and-Tags-to15019888.html)
>>
>> ...and it seems like a community generated patch is probably the only way
>> forward at this point. I started looking into it, but my day job has
>> been way too busy to give me any time to actually code a patch. There's
>> also a question on my part as to whether or not the patch would even be
>> accepted given that 2.0.6 supported type conversion at render time and
>> the core struts2 dev team has explicitly chosen to remove this feature
>> (as mentioned by Don Brown in the referenced bug report).
>>
>>
>> ravi_eze wrote:
>>>
>>> hi,
>>>
>>> We have Action class with Employee Object with setters and getters. The
>>> Typeconverter was configured to be called when <EmployeeObject.empId> is
>>> called by the jsp page. We found that convertFromString of type
>>> converter is being called but convertToString is never called. Any idea
>>> why this is happening? The details are as follows:
>>>
>>> Type converter:
>>> public class LongConverter extends StrutsTypeConverter {
>>>  public Object convertFromString(Map context, String[] values, Class
>>> toClass) {
>>>       ... ....
>>>  }
>>>  public String convertToString(Map context, Object o) {
>>>      ... ....
>>>  }
>>> }
>>>
>>> in actionClass-conversion.properties located along with the class file
>>> in the same package:
>>> employee.empId=com.comp.util.converter.LongConverter
>>>
>>> After some debugging we found that we need to add a new file:
>>> Employee-conversion.properties in the same package of Employee class
>>> with entries:
>>> empId=com.comp.util.converter.LongConverter
>>>
>>> and only then the convertToString would be called. I think we should
>>> have only one conversion.prop file instead of 2. Any ideas why this is
>>> happening this way? or am i missing any thing? please help.
>>>
>>> cheers,
>>> ravi
>>>
>>
>>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_182025.ezm (zipped)
Hi,

i have this code when i get a error

    if( person.getNumId() == null || person.getNumId().trim().length() <
9 ) {
       String[] pars = {"8"};
       this.addFieldError( "field.doc" , this.getText( "
error.val.minlength" , pars ) );
    }

where "field.doc" it is a key with a string associate in a resource file:

field.doc=Identification.

In my errors.properties file i have a error description by "
error.val.minlength":

error.val.minlength=Needs to be {0} characters long at least, for
"${getText(fieldName)}"

but in my pages i get: Needs to be 8 characters long at least, for "".

Why can not i get the string "Identification" associated with the string "
field.doc"?

In the other hand, if i put the validation into xml file like:

  <field name="doc">
    <field-validator type="stringlength">
       <param name="minLength">8</param>
       <param name="trim">true</param>
       <message key="error.val.minlength"/>
    </field-validator>
  </field>

i get: "Needs to be {0} characters long at least, for ""

How can I associated this validation with the key "field.doc" by get
"Identification" througth ${getText(fieldName)} if my field name for this
textfield it is different that key associated it?, and how can i get the
param 8 from this xml sintax?

Sorry for my english, thanks a lot for your help.

Attachment: user_182027.ezm (zipped)
--- stanlick@(protected):
> Yeah, that's what I thought too! I'm passing the parameter via:
>
>           <s:url id="url" action="%{actionClass}_show">
>              <s:param name="model.parentId" value="id"/>
>           </s:url>
>
> and the tag <s:property value="#request.model.parentId" /> outputs the
> number to the top of the page just fine.

Do you have a "model" property in your action?

> In fact, if I use #parameters.model.parentId I get nothing.

If I use a parameter named "foo", set to "bar", I can't dupe this issue.

If I include a "." operator then I'd suspect breakage as OGNL will attempt to
call "getParentId()" on an object called "model". These are expressions, not
simple, unparsed strings.

Dave


Attachment: user_182028.ezm (zipped)
Is my understanding correct that Preparable and ModelDriven are 2 different ways
of doing the same thing, or are they complementary in any way?

After reading up on the website there are a few questions that spring to mind.

* ModelDriven: how do I get hold of my model during my action methods? I don't
want to get getModel() again, because that will retrieve another instance of the
entity and not the one that was populated by struts.

* why do param-prepare-param instead of just prepare-param with

ServletActionContext.getRequest().getParameter("id") in prepare,

which would save a whole cycle through the param interceptor?



Regards
Adam

Attachment: user_182029.ezm (zipped)
--- Adam Hardy <ahardy.struts@(protected):
> Is my understanding correct that Preparable and ModelDriven are 2 different
> ways of doing the same thing, or are they complementary in any way?

They *could* be used to do the same thing, but IMO Preparable is more
general-purpose than ModelDriven, and that's only if you're doing your model
retrieval work in the actual model getter (which I guess a lot of people do?)

> * ModelDriven: how do I get hold of my model during my action methods? I
> don't want to get getModel() again, because that will retrieve another
instance
> of the entity and not the one that was populated by struts.

Lazy initialization (via null check or by setting an instance var), or config
through Spring, or...

> * why do param-prepare-param instead of just prepare-param with
> ServletActionContext.getRequest().getParameter("id") in prepare,
> which would save a whole cycle through the param interceptor?

Most likely to remove that step from the mainline code. It probably depends
on how much logic is dependent on how many parameters.

Personally I don't use Preparable very much, but that's just me and isn't a
general commentary on its usefulness. I just find doing it "manually" is a
bit more clear, particularly when I'm not the only person working on the
code, even more so when the others aren't as used to the S2 request cycle.

I'd definitely be interested in hearing other people's take on this issue,
though, as I try to decide what long-term habits to use for S2 development.

Dave



Attachment: user_182031.ezm (zipped)
Dave Newton on 31/01/08 15:29, wrote:
> --- Adam Hardy <ahardy.struts@(protected):
>> * ModelDriven: how do I get hold of my model during my action methods? I
>> don't want to get getModel() again, because that will retrieve another
> instance
>> of the entity and not the one that was populated by struts.
>
> Lazy initialization (via null check or by setting an instance var), or config
> through Spring, or...

If your getModel() puts the model entity on an instance variable, won't that
confuse the param interceptor? Then it'll have the choice of populating the
model it got from getModel() and it'll see that there's a model entity on the
action too.


Attachment: user_182032.ezm (zipped)
Adam Hardy <ahardy.struts@(protected):
> Dave Newton on 31/01/08 15:29, wrote:
>> Adam Hardy <ahardy.struts@(protected):
>>> * ModelDriven: how do I get hold of my model during my action methods? I
>>> don't want to get getModel() again, because that will retrieve another
>>> instance of the entity and not the one that was populated by struts.
>>
>> Lazy initialization (via null check or by setting an instance var), or
>> config through Spring, or...
>
> If your getModel() puts the model entity on an instance variable, won't
> that confuse the param interceptor?

Depends on what instance variable you put it in, I suppose. One of your
questions was how to access the model object w/o running through a getModel()
method that would re-instantiate; lazily initializing an instance variable in
getModel() then using that instance variable is one way of dealing with that.

> Then it'll have the choice of populating the model it got from
> getModel() and it'll see that there's a model entity on the action
> too.

Again, this is a different issue than I answered. But nobody says the
instance variable needs to be a publicly-accessible JavaBean property.

Dave


Attachment: user_182033.ezm (zipped)
Dave Newton on 31/01/08 16:00, wrote:
> Adam Hardy <ahardy.struts@(protected):
>> Dave Newton on 31/01/08 15:29, wrote:
>>> Adam Hardy <ahardy.struts@(protected):
>>>> * ModelDriven: how do I get hold of my model during my action methods? I
>>>> don't want to get getModel() again, because that will retrieve another
>>>> instance of the entity and not the one that was populated by struts.
>>> Lazy initialization (via null check or by setting an instance var), or
>>> config through Spring, or...
>> If your getModel() puts the model entity on an instance variable, won't
>> that confuse the param interceptor?
>
> Depends on what instance variable you put it in, I suppose. One of your
> questions was how to access the model object w/o running through a getModel()
> method that would re-instantiate; lazily initializing an instance variable in
> getModel() then using that instance variable is one way of dealing with that.

OK, that makes sense now, thanks. What I thought would be the more obvious way
of obtaining the model would be to fetch it from where struts puts it when it
calls getModel(), i.e. the value stack, however I don't see any access methods
for doing that, particulary on ActionSupport.


Adam

Attachment: user_182038.ezm (zipped)
The prepare() method task is to retrive the model
and store it as an instance variable.

The getModel() method will later return the model
when asked by the framework that will put it on the
value stack.

Please correct me if I'm wrong.

Best regards.

--
Robi



Adam Hardy wrote:
> Dave Newton on 31/01/08 16:00, wrote:
>> Adam Hardy <ahardy.struts@(protected):
>>> Dave Newton on 31/01/08 15:29, wrote:
>>>> Adam Hardy <ahardy.struts@(protected):
>>>>> * ModelDriven: how do I get hold of my model during my action
>>>>> methods? I
>>>>> don't want to get getModel() again, because that will retrieve
>>>>> another
>>>>> instance of the entity and not the one that was populated by struts.
>>>> Lazy initialization (via null check or by setting an instance var), or
>>>> config through Spring, or...
>>> If your getModel() puts the model entity on an instance variable, won't
>>> that confuse the param interceptor?
>>
>> Depends on what instance variable you put it in, I suppose. One of your
>> questions was how to access the model object w/o running through a
>> getModel()
>> method that would re-instantiate; lazily initializing an instance
>> variable in
>> getModel() then using that instance variable is one way of dealing
>> with that.
>
> OK, that makes sense now, thanks. What I thought would be the more
> obvious way of obtaining the model would be to fetch it from where
> struts puts it when it calls getModel(), i.e. the value stack, however I
> don't see any access methods for doing that, particulary on ActionSupport.
>
>
> Adam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>


Attachment: user_182040.ezm (zipped)
you are right.

On Jan 31, 2008 1:12 PM, Roberto Nunnari <roberto.nunnari@(protected):
> The prepare() method task is to retrive the model
> and store it as an instance variable.
>
> The getModel() method will later return the model
> when asked by the framework that will put it on the
> value stack.
>
> Please correct me if I'm wrong.
>
> Best regards.
>
> --
> Robi
>
>
>
>
> Adam Hardy wrote:
> > Dave Newton on 31/01/08 16:00, wrote:
> >> Adam Hardy <ahardy.struts@(protected):
> >>> Dave Newton on 31/01/08 15:29, wrote:
> >>>> Adam Hardy <ahardy.struts@(protected):
> >>>>> * ModelDriven: how do I get hold of my model during my action
> >>>>> methods? I
> >>>>> don't want to get getModel() again, because that will retrieve
> >>>>> another
> >>>>> instance of the entity and not the one that was populated by struts.
> >>>> Lazy initialization (via null check or by setting an instance var), or
> >>>> config through Spring, or...
> >>> If your getModel() puts the model entity on an instance variable, won't
> >>> that confuse the param interceptor?
> >>
> >> Depends on what instance variable you put it in, I suppose. One of your
> >> questions was how to access the model object w/o running through a
> >> getModel()
> >> method that would re-instantiate; lazily initializing an instance
> >> variable in
> >> getModel() then using that instance variable is one way of dealing
> >> with that.
> >
> > OK, that makes sense now, thanks. What I thought would be the more
> > obvious way of obtaining the model would be to fetch it from where
> > struts puts it when it calls getModel(), i.e. the value stack, however I
> > don't see any access methods for doing that, particulary on ActionSupport.
> >
> >
> > Adam
> >
> > ---------------------------------------------------------------------
> > 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_182041.ezm (zipped)
--- Roberto Nunnari <roberto.nunnari@(protected):
> The prepare() method task is to retrive the model
> and store it as an instance variable.
>
> The getModel() method will later return the model
> when asked by the framework that will put it on the
> value stack.
>
> Please correct me if I'm wrong.

Some people use getModel() to do more work, that's all; the original question
was how to avoid some of the issues caused by using that pattern.

Dave


Attachment: user_182030.ezm (zipped)
hi,

I have the following use case:

- User provide some input and triggers a long-running simulation process.
- execAndWait interceptor is used while the process is in progress.
- Results are displayed in a report that includes many displaytag
instances along with some charts.

Because some of the resultsets to display (displaytag instances in the
same page) are relatively large I needed to put those along with some
other information Simulation-specific into the Session so if the user
navigates to a different page, displaytag will not trigger a full re-run
of the lengthy simulation process Action.

So far so good. Now the problem is that the users want to run several
simulations simultaneously so this solution does not work anymore. I
thought about creating a MAX_SIMULATIONS_PER_SESSION and rotate some
numeric X <= MAX_SIMULATIONS_PER_SESSION that would be appended to the
session keys and that way the data will not clash in the Session but
then coding the jsp page and handling the synchronization over the
Session key state is sort of ugly.

Is there any easier pattern for this?

TIA,
regards,
Giovanni





Attachment: user_182034.ezm (zipped)
Hi,

When I try to configure un ServletActionRedirectResult i obtain

Caused by:

java.lang.NullPointerException
 at org.apache.struts2.dispatcher.mapper.DefaultActionMapper.getUriFromActionMapping (DefaultActionMapper.java:466)
 at org.apache.struts2.dispatcher.ServletActionRedirectResult.execute (ServletActionRedirectResult.java:184)
 at com.opensymphony.xwork2.DefaultActionInvocation.executeResult (DefaultActionInvocation.java:348)



using

@Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid","${etid}"},type=
ServletActionRedirectResult.class)
public class CreateTableAction extends BaseAction {

  private Long eid;
  private Long etid;

+ getters / setters

BUT using

@Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid7777WHATEVER","${etid}"},type=
ServletActionRedirectResult.class)

works fine

maybe a problem or bug in the implementation

Regards

--
-------------------------------------------
Luis Alberto Gervaso Martin
Java EE Architect & Instructor
C/ Cuenca 4A, 2ºB
Getafe (Madrid)
SPAIN
mobile: (+34) 627983344
luis.gervaso@(protected)

Attachment: user_182035.ezm (zipped)
My workaround

@Result(name="success",value="/jsp/tables/findAllTablesRedirect.jsp", type=
ServletDispatcherResult.class)

/jsp/tables/findAllTablesRedirect.jsp:

<% response.sendRedirect("/eventoos/tables/findAllTables.action?eid="+request.getParameter("eid")+"&etid="+request.getParameter("etid"));
%>

regards

On Jan 31, 2008 5:49 PM, Luis Gervaso <luis.gervaso@(protected):

> Hi,
>
> When I try to configure un ServletActionRedirectResult i obtain
>
> Caused by:
>
> java.lang.NullPointerException
>  at org.apache.struts2.dispatcher.mapper.DefaultActionMapper.getUriFromActionMapping (DefaultActionMapper.java:466)
>
>  at org.apache.struts2.dispatcher.ServletActionRedirectResult.execute (ServletActionRedirectResult.java:184)
>  at com.opensymphony.xwork2.DefaultActionInvocation.executeResult (DefaultActionInvocation.java:348)
>
>
>
> using
>
>
> @Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid","${etid}"},type=
> ServletActionRedirectResult.class)
> public class CreateTableAction extends BaseAction {
>
>   private Long eid;
>   private Long etid;
>
> + getters / setters
>
> BUT using
>
>
> @Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid7777WHATEVER","${etid}"},type=
> ServletActionRedirectResult.class)
>
> works fine
>
> maybe a problem or bug in the implementation
>
> Regards
>
> --
> -------------------------------------------
> Luis Alberto Gervaso Martin
> Java EE Architect & Instructor
> C/ Cuenca 4A, 2ºB
> Getafe (Madrid)
> SPAIN
> mobile: (+34) 627983344
> luis.gervaso@(protected)




--
-------------------------------------------
Luis Alberto Gervaso Martin
Java EE Architect & Instructor
C/ Cuenca 4A, 2ºB
Getafe (Madrid)
SPAIN
mobile: (+34) 627983344
luis.gervaso@(protected)

Attachment: user_182037.ezm (zipped)
I'm not sure I understand; in your annotation example you deliberately
provide a wrongly-named parameter, right? Why?

Dave

--- Luis Gervaso <luis.gervaso@(protected):

> My workaround
>
> @Result(name="success",value="/jsp/tables/findAllTablesRedirect.jsp", type=
> ServletDispatcherResult.class)
>
> /jsp/tables/findAllTablesRedirect.jsp:
>
> <%
>
response.sendRedirect("/eventoos/tables/findAllTables.action?eid="+request.getParameter("eid")+"&etid="+request.getParameter("etid"));
> %>
>
> regards
>
> On Jan 31, 2008 5:49 PM, Luis Gervaso <luis.gervaso@(protected):
>
> > Hi,
> >
> > When I try to configure un ServletActionRedirectResult i obtain
> >
> > Caused by:
> >
> > java.lang.NullPointerException
> >  at
>
org.apache.struts2.dispatcher.mapper.DefaultActionMapper.getUriFromActionMapping (DefaultActionMapper.java:466)
> >
> >  at
>
org.apache.struts2.dispatcher.ServletActionRedirectResult.execute (ServletActionRedirectResult.java:184)
> >  at
>
com.opensymphony.xwork2.DefaultActionInvocation.executeResult (DefaultActionInvocation.java:348)
> >
> >
> >
> > using
> >
> >
> >
>
@Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid","${etid}"},type=
> > ServletActionRedirectResult.class)
> > public class CreateTableAction extends BaseAction {
> >
> >   private Long eid;
> >   private Long etid;
> >
> > + getters / setters
> >
> > BUT using
> >
> >
> >
>
@Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid7777WHATEVER","${etid}"},type=
> > ServletActionRedirectResult.class)
> >
> > works fine
> >
> > maybe a problem or bug in the implementation
> >
> > Regards
> >
> > --
> > -------------------------------------------
> > Luis Alberto Gervaso Martin
> > Java EE Architect & Instructor
> > C/ Cuenca 4A, 2ºB
> > Getafe (Madrid)
> > SPAIN
> > mobile: (+34) 627983344
> > luis.gervaso@(protected)
>
>
>
>
> --
> -------------------------------------------
> Luis Alberto Gervaso Martin
> Java EE Architect & Instructor
> C/ Cuenca 4A, 2ºB
> Getafe (Madrid)
> SPAIN
> mobile: (+34) 627983344
> luis.gervaso@(protected)
>


Attachment: user_182042.ezm (zipped)
Thanks Dave for the reply,

If i put the name "etid" an exception is thrown

If i put a larger parameter "whateverparametername" or simply "_" as
parameter name the redirect works fine, i know it's sounds weird

I thought that it the bug could come if the params attribute was a hash but
looking at the implementation i saw that is a String[]
(i have not investigated deeply if behind there is a hashmap)

Here is the action code

@Result(name="success",value="/jsp/tables/findAllTablesRedirect.jsp", type=
ServletDispatcherResult.class) // this is the fix
/**
* not working annotation
*
*
@Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid","${etid}"},type=
ServletActionRedirectResult.class) // this not work
*
@Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid777","${etid}"},type=
ServletActionRedirectResult.class) // this works (i can't understand why)
**/
public class CreateTableAction extends BaseAction {

  private Long eid;
  private Long etid;

  @Override
  public String execute() throws Exception {
    Model.createTable(eid,etid);
    return SUCCESS;
  }

  public Long getEid() {
    return eid;
  }

  public void setEid(Long eid) {
    this.eid = eid;
  }

  public Long getEtid() {
    return etid;
  }

  public void setEtid(Long etid) {
    this.etid = etid;
  }

}







On Jan 31, 2008 6:30 PM, Dave Newton <newton.dave@(protected):

> I'm not sure I understand; in your annotation example you deliberately
> provide a wrongly-named parameter, right? Why?
>
> Dave
>
> --- Luis Gervaso <luis.gervaso@(protected):
>
> > My workaround
> >
> > @Result(name="success",value="/jsp/tables/findAllTablesRedirect.jsp",
> type=
> > ServletDispatcherResult.class)
> >
> > /jsp/tables/findAllTablesRedirect.jsp:
> >
> > <%
> >
> response.sendRedirect
> ("/eventoos/tables/findAllTables.action?eid="+request.getParameter("eid")+"&etid="+request.getParameter("etid"));
> > %>
> >
> > regards
> >
> > On Jan 31, 2008 5:49 PM, Luis Gervaso <luis.gervaso@(protected):
> >
> > > Hi,
> > >
> > > When I try to configure un ServletActionRedirectResult i obtain
> > >
> > > Caused by:
> > >
> > > java.lang.NullPointerException
> > >   at
> >
>
> org.apache.struts2.dispatcher.mapper.DefaultActionMapper.getUriFromActionMapping
> (DefaultActionMapper.java:466)
> > >
> > >   at
> >
> org.apache.struts2.dispatcher.ServletActionRedirectResult.execute(
> ServletActionRedirectResult.java:184)
> > >   at
> >
> com.opensymphony.xwork2.DefaultActionInvocation.executeResult(
> DefaultActionInvocation.java:348)
> > >
> > >
> > >
> > > using
> > >
> > >
> > >
> >
>
> @Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid","${etid}"},type=
> > > ServletActionRedirectResult.class)
> > > public class CreateTableAction extends BaseAction {
> > >
> > >   private Long eid;
> > >   private Long etid;
> > >
> > > + getters / setters
> > >
> > > BUT using
> > >
> > >
> > >
> >
>
> @Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid7777WHATEVER","${etid}"},type=
> > > ServletActionRedirectResult.class)
> > >
> > > works fine
> > >
> > > maybe a problem or bug in the implementation
> > >
> > > Regards
> > >
> > > --
> > > -------------------------------------------
> > > Luis Alberto Gervaso Martin
> > > Java EE Architect & Instructor
> > > C/ Cuenca 4A, 2ºB
> > > Getafe (Madrid)
> > > SPAIN
> > > mobile: (+34) 627983344
> > > luis.gervaso@(protected)
> >
> >
> >
> >
> > --
> > -------------------------------------------
> > Luis Alberto Gervaso Martin
> > Java EE Architect & Instructor
> > C/ Cuenca 4A, 2ºB
> > Getafe (Madrid)
> > SPAIN
> > mobile: (+34) 627983344
> > luis.gervaso@(protected)
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--
-------------------------------------------
Luis Alberto Gervaso Martin
Java EE Architect & Instructor
C/ Cuenca 4A, 2ºB
Getafe (Madrid)
SPAIN
mobile: (+34) 627983344
luis.gervaso@(protected)

Attachment: user_182036.ezm (zipped)

i use struts2 as back end for my ajax application.

I need to know that is for every request to server the action is
instantiated and destroyed after ? or what ?

Currently i wanna group some method in appropriated actions for best design
.

So doing that is just the same as my first design? no memory luck ? not
things gonna change ?
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_182039.ezm (zipped)
> I need to know that is for every request to server the action is
> instantiated and destroyed after ? or what ?

Yes the action is instantiated on every request.

> Currently i wanna group some method in appropriated actions for best design
> .

that's fine.

>
> So doing that is just the same as my first design? no memory luck ? not
> things gonna change ?

no idea what you meant on this one.

musachy

--
"Hey you! Would you help me to carry the stone?" Pink Floyd
©2008 gg3721.com - Jax Systems, LLC, U.S.A.