Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 1 Feb 2008 16:29:12 -0000 Issue 7837

user-digest-help

2008-02-01


Author LoginPost Reply

user Digest 1 Feb 2008 16:29:12 -0000 Issue 7837

Topics (messages 182068 through 182097):

[S2] Stringlength validator
 182068 by: hezjing

Busy script dialog box appear with Mozilla 2.0.0.8
 182069 by: sagarlotiya

Re: Struts2 tags loops
 182070 by: Filipe David Manana
 182088 by: Randy Burgess

ActionContext.getContext().getSession return null when I test Struts2 action by JUnit.
 182071 by: Joey Watson
 182072 by: Nils-Helge Garli Hegvik
 182074 by: Joey Watson
 182075 by: Joey Watson

Re: Struts tags and Filter Dispatcher Url Pattern-struts 2.1.1
 182073 by: Al Sutton

Re: PO Question about Struts2
 182076 by: issueTracker

Struts and Windows Authentication
 182077 by: Arun
 182078 by: Antonio Petrelli
 182083 by: Cory D. Wiles

Populate Form from DAO
 182079 by: Richard Sayre
 182080 by: LEONARD Julien (Consulting for ACCOR Hotels)
 182081 by: Richard Sayre
 182085 by: Al Sutton

Re: actions defined in a package are visible in other packages??
 182082 by: paulbrickell
 182090 by: Dave Newton
 182091 by: Dave Newton
 182094 by: paulbrickell
 182095 by: paulbrickell

Re: preparable vs modelDriven
 182084 by: Shannon, Andrew

Re: Struts validator
 182086 by: Zhang, Larry \(L.\)
 182087 by: David Harland
 182089 by: Zhang, Larry \(L.\)
 182092 by: Dave Newton
 182093 by: Zhang, Larry \(L.\)
 182096 by: Zhang, Larry \(L.\)
 182097 by: Dave Newton

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_182068.ezm (zipped)
Hi

I think there are typo error in
http://struts.apache.org/2.x/docs/stringlength-validator.html

Missing closing double quote:
<param name="maxLength>10</param>
should be <param name="maxLength">10</param>

Invalid ending tag:
</field-name>
should be </field>

Do we need <field-validator type="stringlength">?


--

Hez

Attachment: user_182069.ezm (zipped)

Hi

When i am trying user <s:head theme="ajax" />
At certain place in Mozilla 2.0.0.8 it displays Busy script dialog box.
If i remove the <s:head theme="ajax" /> then it solves this problem.
But i want to use <s:head theme="ajax" />.

If any one know the cause of this problem and solution please tell me.

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


Attachment: user_182070.ezm (zipped)
Nop. Neither way works.

<s:iterate value="pageCount">
<s:property />
</s:iterate>

This has a single iteration, and the value outputted is the value of
the variable (10 for example).

The <c:forEach> jstl tag, as well as all other jstl tags, is not
allowed in struts 2.0.11, afaik.



On Feb 1, 2008 12:24 AM, Dave Newton <newton.dave@(protected):
> --- Filipe David Manana <fdmanana@(protected):
> > Is there any way to iterate over an integer range with the <s:iterate/>
> > tag? I have an integer property (pageCount) in my action and I want to
> > print all the integer values between 1 and this property in my JSP.
>
> Not that I'm aware of; easier to use <c:forEach.../> IMO.
>
> Dave
>
>



--
Filipe David Manana,
fdmanana@(protected)

Obvious facts are like secrets to those not trained to see them.

Attachment: user_182088.ezm (zipped)
That limitation is only for struts tags, for example <s:property
value="${somevalue}"/>, otherwise you shouldn't have problems with JSTL. I
haven't run into any on 2.0.11.

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



> From: Filipe David Manana <fdmanana@(protected)>
> Reply-To: Struts Users Mailing List <user@(protected)>
> Date: Fri, 1 Feb 2008 09:21:19 +0100
> To: Dave Newton <newton.dave@(protected)>
> Cc: Struts Users Mailing List <user@(protected)>
> Subject: Re: Struts2 tags loops
>
> Nop. Neither way works.
>
> <s:iterate value="pageCount">
>  <s:property />
> </s:iterate>
>
> This has a single iteration, and the value outputted is the value of
> the variable (10 for example).
>
> The <c:forEach> jstl tag, as well as all other jstl tags, is not
> allowed in struts 2.0.11, afaik.
>
>
>
> On Feb 1, 2008 12:24 AM, Dave Newton <newton.dave@(protected):
>> --- Filipe David Manana <fdmanana@(protected):
>>> Is there any way to iterate over an integer range with the <s:iterate/>
>>> tag? I have an integer property (pageCount) in my action and I want to
>>> print all the integer values between 1 and this property in my JSP.
>>
>> Not that I'm aware of; easier to use <c:forEach.../> IMO.
>>
>> Dave
>>
>>
>
>
>
> --
> Filipe David Manana,
> fdmanana@(protected)
>
> Obvious facts are like secrets to those not trained to see them.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>



This email and any attachments ("Message") may contain legally privileged and/or confidential information. If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email. Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege.

Attachment: user_182071.ezm (zipped)
Hi everybody.

I want to test a action class (Struts2) by JUnit. and then method in
this action need a value in session, then when I run my JUnit test
class, ActionContext.getContext().getSession return null. (not
ActionContext.getContext().getSession().get("XXX") return null).
this action class is working fine in browser.


thanks for any help

Joey

Attachment: user_182072.ezm (zipped)
You need to initialize the ActionContext in your unit tests. Take a
look at the Struts 2 tests how it is solved there.

Nils-H

On Feb 1, 2008 9:28 AM, Joey Watson <joey.information@(protected):
> Hi everybody.
>
> I want to test a action class (Struts2) by JUnit. and then method in
> this action need a value in session, then when I run my JUnit test
> class, ActionContext.getContext().getSession return null. (not
> ActionContext.getContext().getSession().get("XXX") return null).
> this action class is working fine in browser.
>
>
> thanks for any help
>
> Joey
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_182074.ezm (zipped)
Thanks, I just checked testing class in Struts2 package, but I am a
newbie for Struts2. I cannot understant Struts2 very well, so if you
don't mind, pls tell me which testing class I can learn from.

Thanks again

On Feb 1, 2008 4:31 PM, Nils-Helge Garli Hegvik <nilsga@(protected):
> You need to initialize the ActionContext in your unit tests. Take a
> look at the Struts 2 tests how it is solved there.
>
> Nils-H
>
>
> On Feb 1, 2008 9:28 AM, Joey Watson <joey.information@(protected):
> > Hi everybody.
> >
> > I want to test a action class (Struts2) by JUnit. and then method in
> > this action need a value in session, then when I run my JUnit test
> > class, ActionContext.getContext().getSession return null. (not
> > ActionContext.getContext().getSession().get("XXX") return null).
> > this action class is working fine in browser.
> >
> >
> > thanks for any help
> >
> > Joey
> >
> > ---------------------------------------------------------------------
> > 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_182075.ezm (zipped)
I found it . like this.

    Map param = new HashMap();
    ActionContext.getContext().setSession(param);

Thanks for your help

On Feb 1, 2008 4:53 PM, Joey <joey.information@(protected):
> Thanks, I just checked testing class in Struts2 package, but I am a
> newbie for Struts2. I cannot understant Struts2 very well, so if you
> don't mind, pls tell me which testing class I can learn from.
>
> Thanks again
>
>
> On Feb 1, 2008 4:31 PM, Nils-Helge Garli Hegvik <nilsga@(protected):
> > You need to initialize the ActionContext in your unit tests. Take a
> > look at the Struts 2 tests how it is solved there.
> >
> > Nils-H
> >
> >
> > On Feb 1, 2008 9:28 AM, Joey Watson <joey.information@(protected):
> > > Hi everybody.
> > >
> > > I want to test a action class (Struts2) by JUnit. and then method in
> > > this action need a value in session, then when I run my JUnit test
> > > class, ActionContext.getContext().getSession return null. (not
> > > ActionContext.getContext().getSession().get("XXX") return null).
> > > this action class is working fine in browser.
> > >
> > >
> > > thanks for any help
> > >
> > > Joey
> > >
> > > ---------------------------------------------------------------------
> > > 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_182073.ezm (zipped)
As a first side note S2.1.1 hasn't been released, so you're either using the
very old S2.1.0 snapshot, or you're using the latest from the Subversion
repository.

Most of the tags in S2.1 need the stack due to the way they are rendered, if
you are using any tags you should have the filter in place because many of
them either use defaults from the stack in order to render correctly, or
some (as is the case for sx:head) set default values in the stack to control
how other tags are rendered.

Al.

----- Original Message -----
From: "Sanjeev Vijapurapu" <SVijapurapu@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Thursday, January 31, 2008 9:48 PM
Subject: RE: Struts tags and Filter Dispatcher Url Pattern-struts 2.1.1


That's what I thought but why does tags need stack when I am not
accessing any of the values. It just has sx:head.
So my question is am I right in saying that struts should be able to
render struts tags as it does jstl tags without worrying abt any stack.
If stack is null, it should treat it as an empty stack rather than
throwing null pointer.

Thanks


-----Original Message-----
From: Dave Newton [mailto:newton.dave@(protected)]
Sent: Thursday, January 31, 2008 1:33 PM
To: Struts Users Mailing List
Subject: Re: Struts tags and Filter Dispatcher Url Pattern-struts 2.1.1

--- Sanjeev Vijapurapu <SVijapurapu@(protected):
> So does this mean that if my jsp is using struts tags, it has to go
> through filter dispatcher?

The filter is what puts the stack into scope so the tags have data to
access
(more or less).

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_182076.ezm (zipped)

thanks for your reply. Got it now =)
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_182077.ezm (zipped)
Hi,

I have a web application in which I need to implement windows
authentication.
Basically there is a login screen where we can enter username and password.
These users are the users that are there in OS.
The username is like domainname\username and password is the password.
A basic authentication dialog wil popup asking this. It should authenticate
against the domain name server.
And forward to home page with the login information.
Can anybody help me on this.?


--
Thanks
Arun George

Attachment: user_182078.ezm (zipped)
2008/2/1, Arun <arun.george.1981@(protected)>:
> Hi,
>
> I have a web application in which I need to implement windows
> authentication.
> Basically there is a login screen where we can enter username and password.
> These users are the users that are there in OS.
> The username is like domainname\username and password is the password.
> A basic authentication dialog wil popup asking this. It should authenticate
> against the domain name server.
> And forward to home page with the login information.
> Can anybody help me on this.?

This may help you a lot:
http://jcifs.samba.org/src/docs/ntlmhttpauth.html

Ciao
Antonio

Attachment: user_182083.ezm (zipped)
At my job we authenticate our users directly using Active Directory using
container managed security.

What container are you using?

On Feb 1, 2008 4:48 AM, Antonio Petrelli <antonio.petrelli@(protected):

> 2008/2/1, Arun <arun.george.1981@(protected)>:
> > Hi,
> >
> > I have a web application in which I need to implement windows
> > authentication.
> > Basically there is a login screen where we can enter username and
> password.
> > These users are the users that are there in OS.
> > The username is like domainname\username and password is the password.
> > A basic authentication dialog wil popup asking this. It should
> authenticate
> > against the domain name server.
> > And forward to home page with the login information.
> > Can anybody help me on this.?
>
> This may help you a lot:
> http://jcifs.samba.org/src/docs/ntlmhttpauth.html
>
> Ciao
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--
Cory Wiles
kwylez@(protected)
http://www.corywiles.com
http://alphaprevails.blogspot.com

Attachment: user_182079.ezm (zipped)
Struts 2 allows us to automatically populate our forms if we name our
fields correctly, which is wonderful.

My actions usually go something like this

execute () {

  MyObject o = myDAO.getRecord(id);

 member1 = o.getMember1();
 member2 = o.getMember2();

}

MyObject is a JO for hold a row in the database. I like the fact that
I can name my form field 'member1' and it the interceptor will set and
get from my Action. I dont like having to set up each member variable
in the action with the members my class. Is it possible to somehow
have Struts automatically populate an Java Object rather then the
Action? I thought I remember reading about this before but I'm not
sure. It's not a big deal, and I know I can use OGNL to access the
value, but I wanted the convience of mapping a fieldName to my custom
object. Is this possible?

Thank you,

Rich

Attachment: user_182080.ezm (zipped)
Did you try :

MyObject theObject;
(geter and setter on theObject)

execute () {

  theObject = myDAO.getRecord(id);
}

And in the JSP : <s:property value="theObject.member1"/>

-----Message d'origine-----
De : Richard Sayre [mailto:richardsayre@(protected)]
Envoyé : vendredi 1 février 2008 13:37
À : Struts Users Mailing List
Objet : Populate Form from DAO

Struts 2 allows us to automatically populate our forms if we name our fields correctly, which is wonderful.

My actions usually go something like this

execute () {

  MyObject o = myDAO.getRecord(id);

 member1 = o.getMember1();
 member2 = o.getMember2();

}

MyObject is a JO for hold a row in the database. I like the fact that I can name my form field 'member1' and it the interceptor will set and get from my Action. I dont like having to set up each member variable in the action with the members my class. Is it possible to somehow have Struts automatically populate an Java Object rather then the Action? I thought I remember reading about this before but I'm not sure. It's not a big deal, and I know I can use OGNL to access the value, but I wanted the convience of mapping a fieldName to my custom object. Is this possible?

Thank you,

Rich

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



This e-mail, any attachments and the information contained therein ("this message") are confidential and intended solely for the use of the addressee(s). If you have received this message in error please send it back to the sender and delete it. Unauthorized publication, use, dissemination or disclosure of this message, either in whole or in part is strictly prohibited.
**********************************************************************
Ce message électronique et tous les fichiers joints ainsi que les informations contenues dans ce message ( ci après "le message" ), sont confidentiels et destinés exclusivement à l'usage de la personne à laquelle ils sont adressés. Si vous avez reçu ce message par erreur, merci de le renvoyer à son émetteur et de le détruire. Toutes diffusion, publication, totale ou partielle ou divulgation sous quelque forme que se soit non expressément autorisées de ce message, sont interdites.
**********************************************************************


Attachment: user_182081.ezm (zipped)
Yes,

I know I can do it this way. I'm just being lazy.

I want:

<s:textfield name="member1"/>

To automatically get/set MyObject.getMeember1() rather then it
automatically setting it in the Action and then having me create the
Object and populate it with values.




On Feb 1, 2008 9:10 AM, LEONARD Julien (Consulting for ACCOR Hotels)
<julien.leonard@(protected):
> Did you try :
>
> MyObject theObject;
> (geter and setter on theObject)
>
> execute () {
>
>   theObject = myDAO.getRecord(id);
> }
>
> And in the JSP : <s:property value="theObject.member1"/>
>
> -----Message d'origine-----
> De : Richard Sayre [mailto:richardsayre@(protected)]
> Envoyé : vendredi 1 février 2008 13:37
> À : Struts Users Mailing List
> Objet : Populate Form from DAO
>
>
> Struts 2 allows us to automatically populate our forms if we name our fields correctly, which is wonderful.
>
> My actions usually go something like this
>
> execute () {
>
>   MyObject o = myDAO.getRecord(id);
>
>   member1 = o.getMember1();
>   member2 = o.getMember2();
>
> }
>
> MyObject is a JO for hold a row in the database. I like the fact that I can name my form field 'member1' and it the interceptor will set and get from my Action. I dont like having to set up each member variable in the action with the members my class. Is it possible to somehow have Struts automatically populate an Java Object rather then the Action? I thought I remember reading about this before but I'm not sure. It's not a big deal, and I know I can use OGNL to access the value, but I wanted the convience of mapping a fieldName to my custom object. Is this possible?
>
> Thank you,
>
> Rich
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
> This e-mail, any attachments and the information contained therein ("this message") are confidential and intended solely for the use of the addressee(s). If you have received this message in error please send it back to the sender and delete it. Unauthorized publication, use, dissemination or disclosure of this message, either in whole or in part is strictly prohibited.
> **********************************************************************
> Ce message électronique et tous les fichiers joints ainsi que les informations contenues dans ce message ( ci après "le message" ), sont confidentiels et destinés exclusivement à l'usage de la personne à laquelle ils sont adressés. Si vous avez reçu ce message par erreur, merci de le renvoyer à son émetteur et de le détruire. Toutes diffusion, publication, totale ou partielle ou divulgation sous quelque forme que se soit non expressément autorisées de ce message, sont interdites.
> **********************************************************************
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_182085.ezm (zipped)
Any reason you're not using ModelDriven?


----- Original Message -----
From: "Richard Sayre" <richardsayre@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Friday, February 01, 2008 1:01 PM
Subject: Re: Populate Form from DAO


Yes,

I know I can do it this way. I'm just being lazy.

I want:

<s:textfield name="member1"/>

To automatically get/set MyObject.getMeember1() rather then it
automatically setting it in the Action and then having me create the
Object and populate it with values.




On Feb 1, 2008 9:10 AM, LEONARD Julien (Consulting for ACCOR Hotels)
<julien.leonard@(protected):
> Did you try :
>
> MyObject theObject;
> (geter and setter on theObject)
>
> execute () {
>
>   theObject = myDAO.getRecord(id);
> }
>
> And in the JSP : <s:property value="theObject.member1"/>
>
> -----Message d'origine-----
> De : Richard Sayre [mailto:richardsayre@(protected)]
> Envoyé : vendredi 1 février 2008 13:37
> À : Struts Users Mailing List
> Objet : Populate Form from DAO
>
>
> Struts 2 allows us to automatically populate our forms if we name our
> fields correctly, which is wonderful.
>
> My actions usually go something like this
>
> execute () {
>
>   MyObject o = myDAO.getRecord(id);
>
>   member1 = o.getMember1();
>   member2 = o.getMember2();
>
> }
>
> MyObject is a JO for hold a row in the database. I like the fact that I
> can name my form field 'member1' and it the interceptor will set and get
> from my Action. I dont like having to set up each member variable in the
> action with the members my class. Is it possible to somehow have Struts
> automatically populate an Java Object rather then the Action? I thought I
> remember reading about this before but I'm not sure. It's not a big deal,
> and I know I can use OGNL to access the value, but I wanted the convience
> of mapping a fieldName to my custom object. Is this possible?
>
> Thank you,
>
> Rich
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
> This e-mail, any attachments and the information contained therein ("this
> message") are confidential and intended solely for the use of the
> addressee(s). If you have received this message in error please send it
> back to the sender and delete it. Unauthorized publication, use,
> dissemination or disclosure of this message, either in whole or in part is
> strictly prohibited.
> **********************************************************************
> Ce message électronique et tous les fichiers joints ainsi que les
> informations contenues dans ce message ( ci après "le message" ), sont
> confidentiels et destinés exclusivement à l'usage de la personne à
> laquelle ils sont adressés. Si vous avez reçu ce message par erreur, merci
> de le renvoyer à son émetteur et de le détruire. Toutes diffusion,
> publication, totale ou partielle ou divulgation sous quelque forme que se
> soit non expressément autorisées de ce message, sont interdites.
> **********************************************************************
>
>
> ---------------------------------------------------------------------
> 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_182082.ezm (zipped)

Could you post a link to the section in the docs. I just cant work this
out.:confused:


Roberto Nunnari wrote:
>
> oops.. I should have read the docs a bit more before posting..
>
> sorry.. for the noise!
>
> --
> Robi.
>
>
> ---------------------------------------------------------------------
> 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_182090.ezm (zipped)
--- paulbrickell <paul.brickell@(protected):
> Could you post a link to the section in the docs. I just cant work this
> out.:confused:

Work what out?

Dave


Attachment: user_182091.ezm (zipped)
Oops.

--- paulbrickell <paul.brickell@(protected):
> Could you post a link to the section in the docs. I just cant work this
> out.:confused:

Work what out?

Packages and namespaces are discussed (at least) at [1, 2].

Dave

[1] http://struts.apache.org/2.x/docs/package-configuration.html
[2] http://struts.apache.org/2.x/docs/namespace-configuration.html



Attachment: user_182094.ezm (zipped)

Thanks,

I had seen those, but the problem I was having was that at no point in the
docs (afaik) is there an example of a URL to actually target an action in a
namespace.

Through a (very tedious) process of trial and error I finally stumbled upon
a (the?) solution.

Actions like these...

<s:action name="space/do"/>
<s:action name="space/do.action"/>
<s:action name="/space/do"/>
<s:action name="/space/do.action"/>

Do not seem to work. However like this...

<s:action name="do" namespace="space"/>

does.

Annoyingly this...

<s:action name="do.action" namespace="space"/>

doesn't seem to work either.

And don't even get me started about using namespaced actions with the a tag.
href="/space/do" doesn't work either. Jeez, I can only think I must be
missing something.

And the final insult when the actions don't resolve properly it fails
silently and all I get is an empty browser.:-/

however this does




newton.dave wrote:
>
> Oops.
>
> --- paulbrickell <paul.brickell@(protected):
>> Could you post a link to the section in the docs. I just cant work this
>> out.:confused:
>
> Work what out?
>
> Packages and namespaces are discussed (at least) at [1, 2].
>
> Dave
>
> [1] http://struts.apache.org/2.x/docs/package-configuration.html
> [2] http://struts.apache.org/2.x/docs/namespace-configuration.html
>
>
>
> ---------------------------------------------------------------------
> 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_182095.ezm (zipped)

Thanks,

I had seen those, but the problem I was having was that at no point in the
docs (afaik) is there an example of a URL to actually target an action in a
namespace.

Through a (very tedious) process of trial and error I finally stumbled upon
a (the?) solution.

Actions like these...

<s:action name="space/do"/>
<s:action name="space/do.action"/>
<s:action name="/space/do"/>
<s:action name="/space/do.action"/>

Do not seem to work. However like this...

<s:action name="do" namespace="space"/>

does.

Annoyingly this...

<s:action name="do.action" namespace="space"/>

doesn't seem to work either.

And don't even get me started about using namespaced actions with the a tag.
href="/space/do" doesn't work either. Jeez, I can only think I must be
missing something.

And the final insult when the actions don't resolve properly it fails
silently and all I get is an empty browser.:-/




newton.dave wrote:
>
> Oops.
>
> --- paulbrickell <paul.brickell@(protected):
>> Could you post a link to the section in the docs. I just cant work this
>> out.:confused:
>
> Work what out?
>
> Packages and namespaces are discussed (at least) at [1, 2].
>
> Dave
>
> [1] http://struts.apache.org/2.x/docs/package-configuration.html
> [2] http://struts.apache.org/2.x/docs/namespace-configuration.html
>
>
>
> ---------------------------------------------------------------------
> 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_182084.ezm (zipped)
I recently made use of model driven and preparable using some of the
advice provided in Roughley's book, and got a clear picture of how these
interceptors work from the forthcoming Manning book. Our situation
required 2 different actions (one provides the form that posts to
another that does the save). We're using annotated validation on our
model with custom validators. This created the need for model driven in
order for the field names to sync up across actions and for the text
field tags to have the same field info in order to do the right
decoration on field error.

The key to making it work was this interceptor stack:

<default-interceptor-ref name="paramsPrepareParamsStack"/> which I
didn't see anyone mention yet.

Understanding what to do with preparable and getModel was a little
tricky, and I think the important thing for me was to make sure my
action was doing one thing. Action 1 - Provide the model to a form.
Action 2 - Handle the form posted model.

Action 1 only had getModel and the property declaration for the model,
but no setter/getter. Prepare took care of setting it, and action 1 was
nice and clean.

Action 2 on the other hand did require the setter/getter plus getModel
and a somewhat strange prepare() in order for info to be made available
from the value stack back to the INPUT result when field errors occur.
Here's the prepare() statement:

  public void prepare() throws Exception {
    if (site == null) {
       site = new Site();
    } else {
       site = getSite();
    }
  }

Since this action handels a form post it makes sense that site is null
and to create a new one that then gets populated with all the form data.
The } else { site = getSite() } part is a kludge and is there strictly
so I can run a test against this action. I could not figure out a way
to get a mocked up site object into the action without doing this.

Has anyone unit tested model driven/preparable actions in this format?

Testing these with the BaseStrutsTestCase found at arsenalist.com was
illuminating to make sure these actions worked. If you haven't used the
test case provided there you need to check it out and start using it
when writing these kinds of actions.

I hope some of this makes sense.

Thanks,
Andrew


-----Original Message-----
From: Adam Hardy [mailto:ahardy.struts@(protected)]
Sent: Thursday, January 31, 2008 5:03 PM
To: Struts Users Mailing List
Subject: Re: preparable vs modelDriven

I don't think you are strictly conveying the intended usage, when you
say that the getModel() method will 'later' return the model. It depends
how your interceptor stack is ordered. In the docs, it explicitly says
the ModelDrivenInterceptor should come before ParametersInterceptor, as
often the PrepareInterceptor does.

Both ModelDriven- and PrepareInterceptor can retrieve the model and
place it in instance variables on the action.

http://struts.apache.org/2.0.11/docs/prepare-interceptor.html

http://struts.apache.org/2.0.11/docs/model-driven-interceptor.html

What I originally wanted to ask (whether I conveyed my question
correctly is another matter) was: what's the difference in intention and
implementation between these two?

Thanks
Adam

Roberto Nunnari on 31/01/08 18:12, wrote:
> 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.
>
> 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.


Attachment: user_182086.ezm (zipped)

Can some Struts guru answer the following questions?
-----Original Message-----
From: Zhang, Larry (L.)
Sent: Thursday, January 31, 2008 3:27 PM
To: 'Struts Users Mailing List'
Subject: Struts validator

Hello coworkers,

I have a questions regarding the struts validation..., say I have three
text fields to be validated in struts validation, and three submit
buttons as well. When I submit one buttion, I only need to validate one
field, and when I click on the other submit button, I need to validate
the other field. Currently, all three fields are validated even though I
don't need to. Is there any way to overcome this issue?

Thanks.

Attachment: user_182087.ezm (zipped)
You can do it by having 3 different methods such as

method1() method2() method3() and then have

validateMethod1() validateMethod2() validateMethod3()

then in your form

<s:submit key="button.method1" method="method1"/>
<s:submit key="button.method2" method="method2"/>
<s:submit key="button.method3" method="method3"/>

or you can do by using action aliases and have three validation xml
files.

http://struts.apache.org/2.0.11/docs/validation.html

-----Original Message-----
From: Zhang, Larry (L.) [mailto:lzhang20@(protected)]
Sent: 01 February 2008 14:45
To: Struts Users Mailing List
Subject: RE: Struts validator


Can some Struts guru answer the following questions?
-----Original Message-----
From: Zhang, Larry (L.)
Sent: Thursday, January 31, 2008 3:27 PM
To: 'Struts Users Mailing List'
Subject: Struts validator

Hello coworkers,

I have a questions regarding the struts validation..., say I have three
text fields to be validated in struts validation, and three submit
buttons as well. When I submit one buttion, I only need to validate one
field, and when I click on the other submit button, I need to validate
the other field. Currently, all three fields are validated even though I
don't need to. Is there any way to overcome this issue?

Thanks.

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


- ------
ML {UFI}

______________________________________________________________________
Ufi Limited
Registered in England No. 3980770
Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP

learndirect Solutions Ltd
Registered in England No. 5081669
Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP

UFI Charitable Trust
Registered in England No. 3658378
Registered Charity No. 1081028
Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP

This email has been scanned by the MessageLabs Email Security System.

______________________________________________________________________

Attachment: user_182089.ezm (zipped)
We are not using Struts 2 tag and thus I can't use s:submit tag.

-----Original Message-----
From: David Harland [mailto:dharland@(protected)]
Sent: Friday, February 01, 2008 10:01 AM
To: Struts Users Mailing List
Subject: RE: Struts validator

You can do it by having 3 different methods such as

method1() method2() method3() and then have

validateMethod1() validateMethod2() validateMethod3()

then in your form

<s:submit key="button.method1" method="method1"/>
<s:submit key="button.method2" method="method2"/>
<s:submit key="button.method3" method="method3"/>

or you can do by using action aliases and have three validation xml
files.

http://struts.apache.org/2.0.11/docs/validation.html

-----Original Message-----
From: Zhang, Larry (L.) [mailto:lzhang20@(protected)]
Sent: 01 February 2008 14:45
To: Struts Users Mailing List
Subject: RE: Struts validator


Can some Struts guru answer the following questions?
-----Original Message-----
From: Zhang, Larry (L.)
Sent: Thursday, January 31, 2008 3:27 PM
To: 'Struts Users Mailing List'
Subject: Struts validator

Hello coworkers,

I have a questions regarding the struts validation..., say I have three
text fields to be validated in struts validation, and three submit
buttons as well. When I submit one buttion, I only need to validate one
field, and when I click on the other submit button, I need to validate
the other field. Currently, all three fields are validated even though I
don't need to. Is there any way to overcome this issue?

Thanks.

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


- ------
ML {UFI}

______________________________________________________________________
Ufi Limited
Registered in England No. 3980770
Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP

learndirect Solutions Ltd
Registered in England No. 5081669
Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP

UFI Charitable Trust
Registered in England No. 3658378
Registered Charity No. 1081028
Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP

This email has been scanned by the MessageLabs Email Security System.

______________________________________________________________________

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


Attachment: user_182092.ezm (zipped)
--- "Zhang, Larry (L.)" <lzhang20@(protected):
> We are not using Struts 2 tag and thus I can't use s:submit tag.

Are you using Struts 2 at all?

You can still use the generated HTML as a template to create your own HTML,
although... not sure why you wouldn't just use the tag in this case.

Dave


Attachment: user_182093.ezm (zipped)

No, I am using struts 1.1, I would like to implement the following case:
In valiation.xml:

<form name="/myAction">
    <!--if submit button 1 clicked, I validate the
following field>
   <field property="myProperty" depends="required">
     <msg name="required" key="error.key1" />
   </field>  

   <!--if submit button 2 clicked, I validate the following
field>
   <field property="name" depends="myValidator">
     <msg name="myValidator"  key="error.key2" />
   </field>
</form>


I don't want to validate both fields at the same time when just one
submit button is clicked. Your helps are appreciated!

-----Original Message-----
From: Dave Newton [mailto:newton.dave@(protected)]
Sent: Friday, February 01, 2008 10:45 AM
To: Struts Users Mailing List
Subject: RE: Struts validator

--- "Zhang, Larry (L.)" <lzhang20@(protected):
> We are not using Struts 2 tag and thus I can't use s:submit tag.

Are you using Struts 2 at all?

You can still use the generated HTML as a template to create your own
HTML,
although... not sure why you wouldn't just use the tag in this case.

Dave


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


Attachment: user_182096.ezm (zipped)
Struts valdiator developers, Doesn't struts support this requirment?

-----Original Message-----
From: Zhang, Larry (L.)
Sent: Friday, February 01, 2008 10:55 AM
To: 'Struts Users Mailing List'
Subject: RE: Struts validator


No, I am using struts 1.1, I would like to implement the following case:
In valiation.xml:

<form name="/myAction">
    <!--if submit button 1 clicked, I validate the
following field>-->
   <field property="myProperty" depends="required">
     <msg name="required" key="error.key1" />
   </field>  

   <!--if submit button 2 clicked, I validate the following
field>-->
   <field property="name" depends="myValidator">
     <msg name="myValidator"  key="error.key2" />
   </field>
</form>


I don't want to validate both fields at the same time when just one
submit button is clicked. Your helps are appreciated!

-----Original Message-----
From: Dave Newton [mailto:newton.dave@(protected)]
Sent: Friday, February 01, 2008 10:45 AM
To: Struts Users Mailing List
Subject: RE: Struts validator

--- "Zhang, Larry (L.)" <lzhang20@(protected):
> We are not using Struts 2 tag and thus I can't use s:submit tag.

Are you using Struts 2 at all?

You can still use the generated HTML as a template to create your own
HTML,
although... not sure why you wouldn't just use the tag in this case.

Dave


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


Attachment: user_182097.ezm (zipped)
--- "Zhang, Larry (L.)" <lzhang20@(protected):
> No, I am using struts 1.1,

Oh, wow.

Does validwhen[1] not exist in S1.1? You can always create a custom validator
as well if you find your validation stretches what's easy to do with the
existing validation configuration possibilities. You may also be able to
combine declarative validation (via XML) and Java-based validation, although
it's been a pretty long time since I've thought about that :)

Dave

[1] http://struts.apache.org/1.1/userGuide/dev_validator.html (about 1/3 of
the way down)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.