Struts 2 and dynamics web page

2010-04-29 Thread Stephane Cosmeur
Hello Struts 2 Users,

I would like to call an action when an envent onchange from a s:select
component is dispatched. According to the selected value I would like to
load data in a form in order to modify it after. To do that i would like to
call a Struts 2 action with AJAX, is it posible and is it the best solution
to perofrm it ?

In the JSP what should i do ?

Case 1: the action return a jsp page inside the main jsp page

@include page=form.jsp

Case 2 : the AJAX request refresh div by calling an action



Any help would be greatly appreciated




-- 
Stéphane Cosmeur
06 33 54 36 04


Re: Submit not passing the form input to the action

2010-04-29 Thread Dale Newfield

On 4/29/10 2:13 PM, Kartik Kumar wrote:

@Nikhil No action form used as I am using Struts2. Each row has a submit
button.


Each row should have it's own form.

-Dale

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



Re: Submit not passing the form input to the action

2010-04-29 Thread Kartik Kumar
@Nikhil No action form used as I am using Struts2. Each row has a submit
button.
2010/4/29 निखिल वाळवेकर 

> Can you please also provide ActionForm details ?
>
> Is your page like this? (I am not aware abt struts 2 tags)
>
> 
> ...
> 
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   *headerValue="Change Status" list="statuses" />*
>   
>   
> 
>* *
>   
>   
>   
> ..
> 
>
> *One form tag covering s:iterator.*
> *
> *
> In that case even if you have one submit button per row, whole form will be
> submitted and your actionForm will be populated.
>
> Regards,
> Nikhil
>
> On Thu, Apr 29, 2010 at 12:42 PM, Jyothi Rajesh 
> wrote:
>
> > Not sure about struts 2, but in struts 1.3, there will need to be a
> > collection object in the action form and this will need to be
> instantiated
> > while declaring. And there needed to be getters and setters for the
> entire
> > collection as well as inidiviual members with index.
> >
>
>
>
> --
> Nikhil
>


Re: Login redirection

2010-04-29 Thread Paweł Wielgus
Hi Mark,
i would suggest the flow like that:
User -requests-> P -check-if-logged-in-and-if-not-forward-to-> C
(story end here)

User -requests-> A -check-if-logged-and-if-yes-forward-to-saved-request_P-> P

where A is special landing page for users coming back from central
security, there should be a mechanism to configure your central
security to forward back your user after a successful login to page A
or maybe there is even a mechanism that can forward him to page P
which he requested at the first place, but that depends from central
security system.

In other words it might generalized to simple check before action execution:
check if user logged in
- if yes then check if there is any saved request for him (this check
can be done only if special landing page A is requested)
-- if yes proceed with saved request
-- if no proceed with actual request
- if no redirect to central security.

I hope that's more clear.

Best greetings,
Paweł Wielgus.

2010/4/29 Mark Hansen :
> Thanks Pawel.
>
> What I don't understand is how, after my user is authenticated by the central 
> security application (say that happens on page C), I can get him back to my 
> struts application and forward him to page P - which he originally requested. 
>  The flow that I need is:
>
> User -> P - forward -> L1 --- forward --> C --- forward --> P
>
>
> 
> From: Paweł Wielgus 
> Reply-To: Struts Users Mailing List 
> Date: Thu, 29 Apr 2010 08:44:29 -0500
> To: Struts Users Mailing List 
> Subject: Re: Login redirection
>
> Hi Mark,
> i don't know the details, but in general when You was redirecting to
> L1 or Ln You had the knowlegde about requested page P, so just
> redirect to this centralized solution but store two things, what was
> requested (page P and maybe also parameters) and some identificator of
> a user (session or cookie).
> When user will come back and You will check if he is authenticated by
> central security app.
> If he is You will be abble to redirect him back to page P based on
> user identificator and original request.
>
> As for the safety of all steps, You should be given secure way of
> asking if a user is authenticated by this central security application
> and a secure way of sending users to this central app - in other words
> You should not reinvent the weel.
>
> Best greetings,
> Paweł Wielgus.
>
>
> 2010/4/27 Mark Hansen :
>> I am working on a Struts 1.x application that has a number of login pages 
>> L1, L2, L3, ...  If a non-authenticated user requests a page - P - that 
>> requires authentication, the user will be redirected to one of these login 
>> pages L1, L2, L3, ... - depending on the context.  Once authenticated, he 
>> proceeds to page P.
>>
>> Now, authentication is being centralized across a variety of applications 
>> (Struts and non-Struts).  All the login pages from my application (L1, L2, 
>> ...) need to be redirected to this central security application (outside my 
>> control) for authentication.  Once the redirected user is authenticated by 
>> the central security application, the user needs to be sent back to his 
>> originally requested page - P.
>>
>> What would be the best way to securely implement this redirected 
>> authentication in the Struts 1.x framework?
>>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>
>

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



Re: Question on WW-2272 fixed by musachy

2010-04-29 Thread Wes Wannemacher
This might be hard to nail down because, in looking at the resolution
date, that looks like he fixed it back before xwork was brought over
into the Apache source repository. You can start over here -
http://www.opensymphony.com/xwork/cvs.action

But, the fisheye instance over at opensymphony has been hosed up for a
while. So, you'll have to actually checkout the code (using the
instructions on that page) and then diff from something like r1779 and
r1780

-Wes

On Thu, Apr 29, 2010 at 12:08 PM, Bhaarat Sharma  wrote:
> I am referring to this JIRA ticket:
> https://issues.apache.org/jira/browse/WW-2272
>
> This code was fixed by musachy and the comment says:
>
>  Fixed on xwork. rv1780
>
> I am just trying to figure out what rv1780 means and how can I traslate that
> to which xwork jar would have this issue fixed?
>
> Currently I have the following xwork jar: xwork-2.0.1.jar
>
> Can someone please help me find which xwork jar version corresponds to
> rv1780?
>
> Thanks
> -bhaarat
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

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



Re: Question on WW-2272 fixed by musachy

2010-04-29 Thread Dale Newfield

On 4/29/10 12:08 PM, Bhaarat Sharma wrote:

https://issues.apache.org/jira/browse/WW-2272

  Fixed on xwork. rv1780

I am just trying to figure out what rv1780 means and how can I traslate that
to which xwork jar would have this issue fixed?


If you hit the "All" tab you'll see:
Fix Version/s:  2.1.3

-Dale

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



Question on WW-2272 fixed by musachy

2010-04-29 Thread Bhaarat Sharma
I am referring to this JIRA ticket:
https://issues.apache.org/jira/browse/WW-2272

This code was fixed by musachy and the comment says:

 Fixed on xwork. rv1780

I am just trying to figure out what rv1780 means and how can I traslate that
to which xwork jar would have this issue fixed?

Currently I have the following xwork jar: xwork-2.0.1.jar

Can someone please help me find which xwork jar version corresponds to
rv1780?

Thanks
-bhaarat


Re: Login redirection

2010-04-29 Thread Mark Hansen
Thanks Pawel.

What I don't understand is how, after my user is authenticated by the central 
security application (say that happens on page C), I can get him back to my 
struts application and forward him to page P - which he originally requested.  
The flow that I need is:

User -> P - forward -> L1 --- forward --> C --- forward --> P



From: Paweł Wielgus 
Reply-To: Struts Users Mailing List 
Date: Thu, 29 Apr 2010 08:44:29 -0500
To: Struts Users Mailing List 
Subject: Re: Login redirection

Hi Mark,
i don't know the details, but in general when You was redirecting to
L1 or Ln You had the knowlegde about requested page P, so just
redirect to this centralized solution but store two things, what was
requested (page P and maybe also parameters) and some identificator of
a user (session or cookie).
When user will come back and You will check if he is authenticated by
central security app.
If he is You will be abble to redirect him back to page P based on
user identificator and original request.

As for the safety of all steps, You should be given secure way of
asking if a user is authenticated by this central security application
and a secure way of sending users to this central app - in other words
You should not reinvent the weel.

Best greetings,
Paweł Wielgus.


2010/4/27 Mark Hansen :
> I am working on a Struts 1.x application that has a number of login pages L1, 
> L2, L3, ...  If a non-authenticated user requests a page - P - that requires 
> authentication, the user will be redirected to one of these login pages L1, 
> L2, L3, ... - depending on the context.  Once authenticated, he proceeds to 
> page P.
>
> Now, authentication is being centralized across a variety of applications 
> (Struts and non-Struts).  All the login pages from my application (L1, L2, 
> ...) need to be redirected to this central security application (outside my 
> control) for authentication.  Once the redirected user is authenticated by 
> the central security application, the user needs to be sent back to his 
> originally requested page - P.
>
> What would be the best way to securely implement this redirected 
> authentication in the Struts 1.x framework?
>

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




Re: Login redirection

2010-04-29 Thread Paweł Wielgus
Hi Mark,
i don't know the details, but in general when You was redirecting to
L1 or Ln You had the knowlegde about requested page P, so just
redirect to this centralized solution but store two things, what was
requested (page P and maybe also parameters) and some identificator of
a user (session or cookie).
When user will come back and You will check if he is authenticated by
central security app.
If he is You will be abble to redirect him back to page P based on
user identificator and original request.

As for the safety of all steps, You should be given secure way of
asking if a user is authenticated by this central security application
and a secure way of sending users to this central app - in other words
You should not reinvent the weel.

Best greetings,
Paweł Wielgus.


2010/4/27 Mark Hansen :
> I am working on a Struts 1.x application that has a number of login pages L1, 
> L2, L3, ...  If a non-authenticated user requests a page - P - that requires 
> authentication, the user will be redirected to one of these login pages L1, 
> L2, L3, ... - depending on the context.  Once authenticated, he proceeds to 
> page P.
>
> Now, authentication is being centralized across a variety of applications 
> (Struts and non-Struts).  All the login pages from my application (L1, L2, 
> ...) need to be redirected to this central security application (outside my 
> control) for authentication.  Once the redirected user is authenticated by 
> the central security application, the user needs to be sent back to his 
> originally requested page - P.
>
> What would be the best way to securely implement this redirected 
> authentication in the Struts 1.x framework?
>

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



Re: Struts 2 validation

2010-04-29 Thread Alex Rodriguez Lopez
If you define action alias for specific methods in your struts.xml (you 
can do so with wildcards too), then you can use this format 
--validation.xml as stated below.


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

Defining Validation Rules
Validation rules can be specified:

Per Action class: in a file named ActionName-validation.xml
Per Action alias: in a file named ActionName-alias-validation.xml
Inheritance hierarchy and interfaces implemented by Action class: XWork 
searches up the inheritance tree of the action to find default 
validations for parent classes of the Action and interfaces implemented


In this context, "Action Alias" refers to the action name as given in 
the Struts configuration. Often, the name attribute matches the method 
name, but they may also differ.


Em 29-04-2010 14:01, David Harland escreveu:

Hi,

Is there any way of creating a struts validation xml for a specific method or 
is the only way of doing through an Action method eg.

public String saveSomething() {
   return SUCCESS;
}

public void validateSaveSomething() {
   //
}

Thanks

Dave.




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




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



Struts 2 validation

2010-04-29 Thread David Harland
Hi,

Is there any way of creating a struts validation xml for a specific method or 
is the only way of doing through an Action method eg.

public String saveSomething() {
  return SUCCESS;
}

public void validateSaveSomething() {
  //
}

Thanks

Dave.


  

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



iterator map and set hidden value

2010-04-29 Thread yunaki

I iterate a  hashmap in object stack, I wish to set each element id to a
hidden tag id  and set element value to the hidden value attribute. Any have
idea? Thx

I tried following code but not work


  



-- 
View this message in context: 
http://old.nabble.com/iterator-map-and-set-hidden-value-tp28398456p28398456.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Annotation Validation

2010-04-29 Thread Alex Rodriguez Lopez
I did try it like so, it is working, but not as expected. I need to pass 
an argument to the resource bundle so it gets correclty displayed with 
the name, for example this property:


error.required = Field {0} is required.

When called like this: getText("error.required", {getText("label.name")});

Is displayed (correctly) like so: "Field name is required".

If I use it like this in the annotation:

key = "error.required"

It will be displayed (incorreclty) like so: "Field {0} is required" 
because args are not supplied to be used in place of the {0}.


Em 28-04-2010 21:30, mrsv escreveu:


Did you try  something like this?

@RequiredStringValidator(
fieldName = "label.name",
 key ="error.required ",
message = "Name required.")}


Alex Rodriguez Lopez wrote:


Hi struts users!

I'm on my way to change from XML based validation to annotation
validation.

I've manage to get it working, but (probably due to my little knowledge
of Java annotations) there are some things I can't get to work, so I
apologise if this question is not entirelly Struts related.

I'm trying to get the following XML based validation to annotations at
method level:




${getText("error.required",
{getText("label.name")})}


...


So far this works in my action:

@Validations(
requiredStrings = {
@RequiredStringValidator(
fieldName = "user.name",
message = "Name required.")}
)
public String save() {
...
return SUCCESS;
}

But the problem is with this bit${getText("error.required",
{getText("label.name")})}  which retrieves a message that has
arguments (also retrieved from a resource bundle).

So how should I use the annotation parameters (key or message) to
retrieve a key with args?

I tried message = getText("error.required", new
String[]{getText("label.name")})

but of course values of annotation params must be constant, and I cannot
define a static value that depends on a getText() lookup.

Is this ever possible to do with annotations?

Any help appreciated!!

Summary: How to use i18n messages with args using annotations for field
validation?

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








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



Re: Submit not passing the form input to the action

2010-04-29 Thread निखिल वाळवेकर
Can you please also provide ActionForm details ?

Is your page like this? (I am not aware abt struts 2 tags)


...

   
   
   
   
   
   
   
   
   
   **
   
   
 
* *
   
   
   
..


*One form tag covering s:iterator.*
*
*
In that case even if you have one submit button per row, whole form will be
submitted and your actionForm will be populated.

Regards,
Nikhil

On Thu, Apr 29, 2010 at 12:42 PM, Jyothi Rajesh  wrote:

> Not sure about struts 2, but in struts 1.3, there will need to be a
> collection object in the action form and this will need to be instantiated
> while declaring. And there needed to be getters and setters for the entire
> collection as well as inidiviual members with index.
>



-- 
Nikhil


Re: Submit not passing the form input to the action

2010-04-29 Thread Jyothi Rajesh
Not sure about struts 2, but in struts 1.3, there will need to be a
collection object in the action form and this will need to be instantiated
while declaring. And there needed to be getters and setters for the entire
collection as well as inidiviual members with index.