Re: Browser Back button intercept, no javascript

2022-01-26 Thread Lukasz Lenart
It won't be possible to detect that the given request reached your
application because a user hit the Back button. There is no indication
in HTTP protocol that could tell you so.

Regards
Łukasz

wt., 25 sty 2022 o 22:58 albert kao  napisał(a):
>
> If the user presses the Back button of a browser, my application likes to
> intercept that and display a text message at the current web page.
> How to do that without using javascript?
>
> The following codes show an approach with AbstractInterceptor.
> Please review whether it will work.
> If yes, how to get the flag or value that the Back button of a browser was
> pressed?
> If not, please suggest alternatives.
> Thanks.
>
>
> import java.util.Map;
>
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpSession;
>
> import org.apache.struts2.StrutsStatics;
>
> import com.opensymphony.xwork2.ActionContext;
> import com.opensymphony.xwork2.ActionInvocation;
> import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
>
>
> public class MyInterceptor extends AbstractInterceptor {
> private Map session;
>
> @Override
> public class MyInterceptor extends AbstractInterceptor {
> private Map session;
>
> @Override
> public String intercept(ActionInvocation invocation) throws Exception {
>final ActionContext context = invocation.getInvocationContext();
>session = context.getSession();
>HttpServletRequest request = (HttpServletRequest);
>   context.get(StrutsStatics.HTTP_REQUEST);
>HttpSession httpSession = request.getSession(true);
>
>synchronized (httpSession) {
>//...
>}
>   }
> }
>
> Struts version is 2.5.26.
>
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> Virus-free.
> www.avg.com
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

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



Browser Back button intercept, no javascript

2022-01-25 Thread albert kao
If the user presses the Back button of a browser, my application likes to
intercept that and display a text message at the current web page.
How to do that without using javascript?

The following codes show an approach with AbstractInterceptor.
Please review whether it will work.
If yes, how to get the flag or value that the Back button of a browser was
pressed?
If not, please suggest alternatives.
Thanks.


import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.StrutsStatics;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;


public class MyInterceptor extends AbstractInterceptor {
private Map session;

@Override
public class MyInterceptor extends AbstractInterceptor {
private Map session;

@Override
public String intercept(ActionInvocation invocation) throws Exception {
   final ActionContext context = invocation.getInvocationContext();
   session = context.getSession();
   HttpServletRequest request = (HttpServletRequest);
  context.get(StrutsStatics.HTTP_REQUEST);
   HttpSession httpSession = request.getSession(true);

   synchronized (httpSession) {
   //...
   }
  }
}

Struts version is 2.5.26.

<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


Re: Struts 2.3.28.1 - Populate Java Property from Controller inside JavaScript

2016-08-29 Thread Christoph Nenning
> Hi all,
> 
> First of all, greetings, from Brazil.
> 
> I would like to populate this Java Script variable with name
> *flightPlanCoordinates
> *from a Action Controller.
> 
> var flightPlanCoordinates = [
> 
> 
> {lat: -23.533592, lng: -46.742744},
> 
> {lat: -23.533592, lng: -46.742744},
> 
> {lat: -23.533870, lng: -46.742804},
> 
> {lat: -23.533978, lng: -46.742890}
> ];
> 
> Whats the best approach to do? I how can I use tag libs from Struts to
> mount this *flightPlanCoordinates ?*
> 
> 
> Thanks in advance,
> 
> 
> Bisconcini


Hi,

it depends how your java classes look like.

If you have a class like this one:

public class Coordinates {
private double lat;
private double lng;
}


You could have a list in your acton:

public class SomeAction {
private List coordinates;

...

public List getCoordinates() {
return coordinates;
}

}


In a JSP you could access coordinates like this:

var flightPlanCoordinates = [

{lat: , 
lng: },

]


Be aware that this is just a very simple example. You should adjust it to 
your app.


Regards,
Christoph

This Email was scanned by Sophos Anti Virus


Re: Struts 2.3.28.1 - Populate Java Property from Controller inside JavaScript

2016-08-29 Thread Lukasz Lenart
2016-08-27 0:08 GMT+02:00 Guilherme Bisconcini
:
> Hi all,
>
> First of all, greetings, from Brazil.
>
> I would like to populate this Java Script variable with name
> *flightPlanCoordinates
> *from a Action Controller.
>
> var flightPlanCoordinates = [
>
>
> {lat: -23.533592, lng: -46.742744},
>
> {lat: -23.533592, lng: -46.742744},
>
> {lat: -23.533870, lng: -46.742804},
>
> {lat: -23.533978, lng: -46.742890}
> ];
>
> Whats the best approach to do? I how can I use tag libs from Struts to
> mount this *flightPlanCoordinates ?*

I'd rather use a JSON endpoint instead of directly populating such
variable in a page.


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Struts 2.3.28.1 - Populate Java Property from Controller inside JavaScript

2016-08-26 Thread Guilherme Bisconcini
Hi all,

First of all, greetings, from Brazil.

I would like to populate this Java Script variable with name
*flightPlanCoordinates
*from a Action Controller.

var flightPlanCoordinates = [


{lat: -23.533592, lng: -46.742744},

{lat: -23.533592, lng: -46.742744},

{lat: -23.533870, lng: -46.742804},

{lat: -23.533978, lng: -46.742890}
];

Whats the best approach to do? I how can I use tag libs from Struts to
mount this *flightPlanCoordinates ?*


Thanks in advance,


Bisconcini


Re: How to Use JavaScript in Struts2

2014-06-04 Thread Dave Newton
It's not clear to me what the underlying question is.

If you have a lot of dynamic elements on the page you'll probably want to
look at the S2 jQuery library:

https://code.google.com/p/struts2-jquery/

It makes simple usecases drop-dead easy, and might be enough to serve your
needs--although using plain old jQuery is also a valid option, and might
fit in this case.

The Struts 2 Dojo tags have been deprecated for several releases and
shouldn't be used for a variety of reasons.

While the S2 jQuery tags might be useful, on highly dynamic pages you might
be better off using S2 as a service layer and using a client-side
framework, like React.js, Backbone + Marionette (or similar), Angular, etc.

Dave



On Wed, Jun 4, 2014 at 1:20 AM, NIJO GEORGE  wrote:

> Hi,
> I'm developing an an application to conduct Online Examinations. Lots of
> table displays are used in every module. for example Questions, Exam,
> Results, etc,
> I have a form which saves a question to db.
>
> My Scenario is Following I Have three types of Questions
> 1. Single choice
> 2. Mutiple Choice
> 3. Subjective
>
> while Inserting a Question I can Choose the number of options for that
> particular question.
> depends on the number of options the input boxes of options should be
> generated.
>
> After inserting options there should be a Radio Button Group which chooses
> the type of Answer.
> If it is Single Choice,
> A select control should be populated with the number of options given. Here
> we choose the correct answer for that particular question.
> Also there is a radio button group to choose how the options should be
> displayed to the candidate.
>
> If it is Multiple Choice Question ,
> A checkbox group should be generated with the above number of options.
> at this time the radio button group which decides the show options as
> should be disabled.
>
> If it is subjective question the correct answer control should be textarea
> this should be generated.
>
> How this can be implemented with struts2, How to use Struts2 Tags for this
> purpose
>



-- 
e: davelnew...@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton 
b: Bucky Bits 
g: davelnewton 
so: Dave Newton 


Re: How to Use JavaScript in Struts2

2014-06-04 Thread Dave Newton
I don't even know what any of this has to do with anything the OP asked.

Beyond being difficult to read because of the poor formatting, you're also
pointing the OP at a deprecated library.



On Wed, Jun 4, 2014 at 6:42 AM, Martin Gainty  wrote:

>
>
>
>
> > From: nijo...@gmail.com
> > Date: Wed, 4 Jun 2014 10:50:14 +0530
> > Subject: How to Use JavaScript in Struts2
> > To: user@struts.apache.org
> >
> > Hi,
> > I'm developing an an application to conduct Online Examinations. Lots of
> > table displays are used in every module. for example Questions, Exam,
> > Results, etc,
> > I have a form which saves a question to db.
> >
> > My Scenario is Following I Have three types of Questions
> > 1. Single choice
> > 2. Mutiple Choice
> > 3. Subjective
> >
> > while Inserting a Question I can Choose the number of options for that
> > particular question.
> > depends on the number of options the input boxes of options should be
> > generated.
> MG>you already have TestCases for each scenario
> >
> > After inserting options there should be a Radio Button Group which
> chooses
> > the type of Answer.
> > If it is Single Choice,
> > A select control should be populated with the number of options given.
> Here
> > we choose the correct answer for that particular question.
> > Also there is a radio button group to choose how the options should be
> > displayed to the candidate.
> MG>No JS go with
> \core\src\main\java\org\apache\struts2\views\jsp\ui\RadioTag.java
> MG>With JS go with
> \plugins\dojo\init\src\core\src\test\java\org\apache\struts2\views\jsp\ui\RadioTest.java
> >
> > If it is Multiple Choice Question ,
> > A checkbox group should be generated with the above number of options.
> > at this time the radio button group which decides the show options as
> > should be disabled.
> MG>No JS go with
> plugins\javatemplates\src\test\java\org\apache\struts2\views\java\simple\SelectTest.java
> MG>With JS go with
>  
> \plugins\dojo\init\src\core\src\test\java\org\apache\struts2\views\jsp\ui\SelectTest.java
> >
> > If it is subjective question the correct answer control should be
> textarea
> > this should be generated.
> MG>No JS go with
> plugins\javatemplates\src\test\java\org\apache\struts2\views\java\simple\TextAreaTest.java
> MG>With JS go with
>  
> \plugins\dojo\init\src\core\src\test\java\org\apache\struts2\views\jsp\ui\TextAreaTest.java
> >
> > How this can be implemented with struts2, How to use Struts2 Tags for
> this
> > purpose
>
>



-- 
e: davelnew...@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton <https://twitter.com/dave_newton>
b: Bucky Bits <http://buckybits.blogspot.com/>
g: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>


RE: How to Use JavaScript in Struts2

2014-06-04 Thread Martin Gainty


   


> From: nijo...@gmail.com
> Date: Wed, 4 Jun 2014 10:50:14 +0530
> Subject: How to Use JavaScript in Struts2
> To: user@struts.apache.org
> 
> Hi,
> I'm developing an an application to conduct Online Examinations. Lots of
> table displays are used in every module. for example Questions, Exam,
> Results, etc,
> I have a form which saves a question to db.
> 
> My Scenario is Following I Have three types of Questions
> 1. Single choice
> 2. Mutiple Choice
> 3. Subjective
> 
> while Inserting a Question I can Choose the number of options for that
> particular question.
> depends on the number of options the input boxes of options should be
> generated.
MG>you already have TestCases for each scenario
> 
> After inserting options there should be a Radio Button Group which chooses
> the type of Answer.
> If it is Single Choice,
> A select control should be populated with the number of options given. Here
> we choose the correct answer for that particular question.
> Also there is a radio button group to choose how the options should be
> displayed to the candidate.
MG>No JS go with 
\core\src\main\java\org\apache\struts2\views\jsp\ui\RadioTag.java
MG>With JS go with 
\plugins\dojo\init\src\core\src\test\java\org\apache\struts2\views\jsp\ui\RadioTest.java
> 
> If it is Multiple Choice Question ,
> A checkbox group should be generated with the above number of options.
> at this time the radio button group which decides the show options as
> should be disabled.
MG>No JS go with 
plugins\javatemplates\src\test\java\org\apache\struts2\views\java\simple\SelectTest.java
MG>With JS go with  
\plugins\dojo\init\src\core\src\test\java\org\apache\struts2\views\jsp\ui\SelectTest.java
> 
> If it is subjective question the correct answer control should be textarea
> this should be generated.
MG>No JS go with 
plugins\javatemplates\src\test\java\org\apache\struts2\views\java\simple\TextAreaTest.java
MG>With JS go with  
\plugins\dojo\init\src\core\src\test\java\org\apache\struts2\views\jsp\ui\TextAreaTest.java
> 
> How this can be implemented with struts2, How to use Struts2 Tags for this
> purpose
  

Re: How to Use JavaScript in Struts2

2014-06-04 Thread Christoph Nenning
> Hi,
> I'm developing an an application to conduct Online Examinations. Lots of
> table displays are used in every module. for example Questions, Exam,
> Results, etc,
> I have a form which saves a question to db.
> 
> My Scenario is Following I Have three types of Questions
> 1. Single choice
> 2. Mutiple Choice
> 3. Subjective
> 
> while Inserting a Question I can Choose the number of options for that
> particular question.
> depends on the number of options the input boxes of options should be
> generated.
> 
> After inserting options there should be a Radio Button Group which 
chooses
> the type of Answer.
> If it is Single Choice,
> A select control should be populated with the number of options given. 
Here
> we choose the correct answer for that particular question.
> Also there is a radio button group to choose how the options should be
> displayed to the candidate.
> 
> If it is Multiple Choice Question ,
> A checkbox group should be generated with the above number of options.
> at this time the radio button group which decides the show options as
> should be disabled.
> 
> If it is subjective question the correct answer control should be 
textarea
> this should be generated.
> 
> How this can be implemented with struts2, How to use Struts2 Tags for 
this
> purpose


have a look here:
https://struts.apache.org/release/2.3.x/docs/tag-reference.html


This Email was scanned by Sophos Anti Virus


How to Use JavaScript in Struts2

2014-06-03 Thread NIJO GEORGE
Hi,
I'm developing an an application to conduct Online Examinations. Lots of
table displays are used in every module. for example Questions, Exam,
Results, etc,
I have a form which saves a question to db.

My Scenario is Following I Have three types of Questions
1. Single choice
2. Mutiple Choice
3. Subjective

while Inserting a Question I can Choose the number of options for that
particular question.
depends on the number of options the input boxes of options should be
generated.

After inserting options there should be a Radio Button Group which chooses
the type of Answer.
If it is Single Choice,
A select control should be populated with the number of options given. Here
we choose the correct answer for that particular question.
Also there is a radio button group to choose how the options should be
displayed to the candidate.

If it is Multiple Choice Question ,
A checkbox group should be generated with the above number of options.
at this time the radio button group which decides the show options as
should be disabled.

If it is subjective question the correct answer control should be textarea
this should be generated.

How this can be implemented with struts2, How to use Struts2 Tags for this
purpose


Re: S2: Not generating javascript validation

2013-10-01 Thread Lukasz Lenart
I have updated the example to show how validation works with !

https://github.com/lukaszlenart/struts2-dmi-validation

2013/10/2 Lukasz Lenart :
> 2013/10/1 Néstor Boscán :
>> Sorry I made that change so I could use only login in the form tag to make
>> the validation work.
>
> Ok, but you have LoginAction-validation.xml which should be applied to
> the whole LoginAction - doesn't matter what method do you use. I have
> prepared a small example base on [1] and cannot confirm your problem -
> JS validation works. Could you prepare a small example?
>
> Please remember that there as some methods excluded from validation:
> input,back,cancel,browse
>
>
> [1] https://github.com/lukaszlenart/struts2-dmi-validation
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/

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



Re: S2: Not generating javascript validation

2013-10-01 Thread Lukasz Lenart
2013/10/1 Néstor Boscán :
> Sorry I made that change so I could use only login in the form tag to make
> the validation work.

Ok, but you have LoginAction-validation.xml which should be applied to
the whole LoginAction - doesn't matter what method do you use. I have
prepared a small example base on [1] and cannot confirm your problem -
JS validation works. Could you prepare a small example?

Please remember that there as some methods excluded from validation:
input,back,cancel,browse


[1] https://github.com/lukaszlenart/struts2-dmi-validation


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Re: S2: Not generating javascript validation

2013-10-01 Thread Néstor Boscán
Sorry I made that change so I could use only login in the form tag to make
the validation work.

On Tuesday, October 1, 2013, Lukasz Lenart  wrote:
> 2013/9/30 Néstor Boscán :
>> 
>
> Why do you use login!login as action login is already defined to use
> login method?
>
> So login.action is the same as login!login.action (just drop .action)
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: S2: Not generating javascript validation

2013-09-30 Thread Lukasz Lenart
2013/9/30 Néstor Boscán :
> 

Why do you use login!login as action login is already defined to use
login method?

So login.action is the same as login!login.action (just drop .action)


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Re: S2: Not generating javascript validation

2013-09-30 Thread Néstor Boscán
I have:

struts.xml:

  
  
  
  
  
  
  
  
  
  
  


struts-seguridad.xml:


  

  /WEB-INF/jsp/seguridad/login.jsp
  /WEB-INF/jsp/seguridad/login.jsp
  /WEB-INF/jsp/seguridad/login.jsp

  


Thanks for the help


On Sun, Sep 22, 2013 at 1:49 PM, Lukasz Lenart wrote:

> Can you post your struts.xml? And you don't have such constant defined
>  /> ?
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> 2013/9/22 Néstor Boscán :
> > Yes and it doesn't work. It only works with "login".
> >
> > Thanks for the help
> >
> > On Sunday, September 22, 2013, Lukasz Lenart 
> > wrote:
> >> 2013/9/22 Néstor Boscán :
> >>> Hi
> >>>
> >>>  >>> validate="true">
> >>
> >> Have you tried to use: login!login ? Attribute action expects action
> >> name, not how it is rendered (i.e. if you change default action
> >> extension to .html)
> >>
> >>
> >> Regards
> >> --
> >> Łukasz
> >> + 48 606 323 122 http://www.lenart.org.pl/
> >>
> >> -
> >> 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: S2: Not generating javascript validation

2013-09-22 Thread Lukasz Lenart
Can you post your struts.xml? And you don't have such constant defined
 ?


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

2013/9/22 Néstor Boscán :
> Yes and it doesn't work. It only works with "login".
>
> Thanks for the help
>
> On Sunday, September 22, 2013, Lukasz Lenart 
> wrote:
>> 2013/9/22 Néstor Boscán :
>>> Hi
>>>
>>> >> validate="true">
>>
>> Have you tried to use: login!login ? Attribute action expects action
>> name, not how it is rendered (i.e. if you change default action
>> extension to .html)
>>
>>
>> Regards
>> --
>> Łukasz
>> + 48 606 323 122 http://www.lenart.org.pl/
>>
>> -
>> 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: S2: Not generating javascript validation

2013-09-22 Thread Néstor Boscán
Yes and it doesn't work. It only works with "login".

Thanks for the help

On Sunday, September 22, 2013, Lukasz Lenart 
wrote:
> 2013/9/22 Néstor Boscán :
>> Hi
>>
>> > validate="true">
>
> Have you tried to use: login!login ? Attribute action expects action
> name, not how it is rendered (i.e. if you change default action
> extension to .html)
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: S2: Not generating javascript validation

2013-09-22 Thread Lukasz Lenart
2013/9/22 Néstor Boscán :
> Hi
>
>  validate="true">

Have you tried to use: login!login ? Attribute action expects action
name, not how it is rendered (i.e. if you change default action
extension to .html)


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Re: S2: Not generating javascript validation

2013-09-22 Thread Néstor Boscán
Yes that seems to be the problem. But I have many applications working on
older struts 2 libraries and the dmi + javascript validation worked.

On Sunday, September 22, 2013, JOSE L MARTINEZ-AVIAL 
wrote:
> Maybe it is not able to match the action name in the form (with the
!login) with the action definition? I would take a look at the source to
see how the match is done.
>
>
> 2013/9/22 Néstor Boscán 
>>
>> Yes I reenabled DMI but javascript validation is not working when using
DMI. If you use action!method the javascript field validations won't appear.
>>
>> On Sun, Sep 22, 2013 at 2:47 AM, Chris Pratt 
wrote:
>>>
>>> I believe one of the recent changes was to change the default to
disabling
>>> DMI, but you can re-enable it if you understand the risks.
>>>   (*Chris*)
>>>
>>>
>>> On Sat, Sep 21, 2013 at 6:20 PM, Néstor Boscán 
wrote:
>>>
>>> > Hi
>>> >
>>> > >> > validate="true">
>>> > 
>>> > >> > cssClass="mystyle1"/>
>>> > >> > cssClass="mystyle1"/>
>>> > 
>>> >
>>> > It looks like this version of Struts 2 doesn't like the Dynamic Method
>>> > Invocation in login!login.action. If I don't use DMI it works. Older
>>> > versions of the framework worked with DMI.
>>> >
>>> > Regards,
>>> >
>>> > Néstor
>>> >
>>> >
>>> > On Sat, Sep 21, 2013 at 5:24 PM,  wrote:
>>> >
>>> > > Can you provide the jsp snipset for the form?
>>> > > Sent via BlackBerry from T-Mobile
>>> > >
>>> > > -Original Message-
>>> > > From: Néstor Boscán 
>>> > > Date: Sat, 21 Sep 2013 16:15:23
>>> > > To: Struts Users Mailing List
>>> > > Reply-To: "Struts Users Mailing List" 
>>> > > Subject: S2: Not generating javascript validation
>>> > >
>>> > > Hi
>>> > >
>>> > > I'm using the latest 2.3.15.2 version of struts 2 on weblogic
10.3.6.
>>> > This
>>> > > are my files:
>>> > >
>>> > > LoginAction-validation.xml:
>>> > >
>>> > > >> > > "-//Apache Struts//XWork Validator 1.0.3//EN"
>>> > > "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd";>
>>> > > 
>>> > >   
>>> > > 
>>> > >   El usuario es requerido
>>> > > 
>>> > >   
>>> > >   
>>> > > 
>>> > >   La contrasenia es requerida
>>> > > 
>>> > >   
>>> > > 
>>> > >
>>> > > validators.xml:
>>> > >
>>> > > 
>>> > > >> > > "-//Apache Struts//XWork Validator Definition 1.0//EN"
>>> > > "
>>> > http://struts.apache.org/dtds/xwork-validator-definition-1.0.dtd
>>> > > ">
>>> > > 
>>> > > >> > >
>>> > >
>>> >
class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/>
>>> > > >> > >
>>> > >
>>> >
class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/>
>>> > > >> > >
>>> > >
>>> >
class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/>
>>> > > >> > >
>>> > >
>>> >
class="com.opensymphony.xwork2.validator.validators.LongRangeFieldValidator"/>
>>> > > >> > >
>>> > >
>>> >
class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/>
>>> > > >> > >
>>> > >
>>> >
class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/>
>>> > > >> > >
>>> > >
>>> >
class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/>
>>> > > >> > >
>>> >
class="com.opensymphony.xwork2.validator.validators.ExpressionValidator"/>
>>> &g

Re: S2: Not generating javascript validation

2013-09-22 Thread Néstor Boscán
Yes I reenabled DMI but javascript validation is not working when using
DMI. If you use action!method the javascript field validations won't appear.


On Sun, Sep 22, 2013 at 2:47 AM, Chris Pratt wrote:

> I believe one of the recent changes was to change the default to disabling
> DMI, but you can re-enable it if you understand the risks.
>   (*Chris*)
>
>
> On Sat, Sep 21, 2013 at 6:20 PM, Néstor Boscán  wrote:
>
> > Hi
> >
> >  > validate="true">
> > 
> >  > cssClass="mystyle1"/>
> >  > cssClass="mystyle1"/>
> > 
> >
> > It looks like this version of Struts 2 doesn't like the Dynamic Method
> > Invocation in login!login.action. If I don't use DMI it works. Older
> > versions of the framework worked with DMI.
> >
> > Regards,
> >
> > Néstor
> >
> >
> > On Sat, Sep 21, 2013 at 5:24 PM,  wrote:
> >
> > > Can you provide the jsp snipset for the form?
> > > Sent via BlackBerry from T-Mobile
> > >
> > > -Original Message-
> > > From: Néstor Boscán 
> > > Date: Sat, 21 Sep 2013 16:15:23
> > > To: Struts Users Mailing List
> > > Reply-To: "Struts Users Mailing List" 
> > > Subject: S2: Not generating javascript validation
> > >
> > > Hi
> > >
> > > I'm using the latest 2.3.15.2 version of struts 2 on weblogic 10.3.6.
> > This
> > > are my files:
> > >
> > > LoginAction-validation.xml:
> > >
> > >  > > "-//Apache Struts//XWork Validator 1.0.3//EN"
> > > "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd";>
> > > 
> > >   
> > > 
> > >   El usuario es requerido
> > > 
> > >   
> > >   
> > > 
> > >   La contrasenia es requerida
> > > 
> > >   
> > > 
> > >
> > > validators.xml:
> > >
> > > 
> > >  > > "-//Apache Struts//XWork Validator Definition 1.0//EN"
> > > "
> > http://struts.apache.org/dtds/xwork-validator-definition-1.0.dtd
> > > ">
> > > 
> > >  > >
> > >
> >
> class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/>
> > >  > >
> > >
> >
> class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/>
> > >  > >
> > >
> >
> class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/>
> > >  > >
> > >
> >
> class="com.opensymphony.xwork2.validator.validators.LongRangeFieldValidator"/>
> > >  > >
> > >
> >
> class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/>
> > >  > >
> > >
> >
> class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/>
> > >  > >
> > >
> >
> class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/>
> > >  > >
> >
> class="com.opensymphony.xwork2.validator.validators.ExpressionValidator"/>
> > >  > >
> > >
> >
> class="com.opensymphony.xwork2.validator.validators.FieldExpressionValidator"/>
> > >  > > class="com.opensymphony.xwork2.validator.validators.EmailValidator"/>
> > >  > > class="com.opensymphony.xwork2.validator.validators.URLValidator"/>
> > >  > >
> > >
> >
> class="com.opensymphony.xwork2.validator.validators.VisitorFieldValidator"/>
> > >  > >
> > >
> >
> class="com.opensymphony.xwork2.validator.validators.ConversionErrorFieldValidator"/>
> > >  > >
> > >
> >
> class="com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator"/>
> > >  > >
> >
> class="com.opensymphony.xwork2.validator.validators.RegexFieldValidator"/>
> > >  > >
> > >
> >
> class="com.opensymphony.xwork2.validator.validators.ConditionalVisitorFieldValidator"/>
> > > 
> > >
> > > The form tag has validate="true".
> > >
> > > When I generate the login page I get:
> > >
> > > 
> > > function validateForm_login() {
> > > var getFieldValue = function(field) {
> > > var type = field.type ? field.type : field[0].type;
> > > if (type == 'select-one' || type == 'select-multiple') {
> > > return (field.selectedIndex == -1 ? "" :
> > > field.options[field.selectedIndex].value);
> > > } else if (type == 'checkbox' || type == 'radio') {
> > > if (!field.length) {
> > > field = [field];
> > > }
> > > for (var i = 0; i < field.length; i++) {
> > > if (field[i].checked) {
> > > return field[i].value;
> > > }
> > > }
> > > return "";
> > > }
> > > return field.value;
> > > }
> > > form = document.getElementById("login");
> > > clearErrorMessages(form);
> > > clearErrorLabels(form);
> > >
> > > var errors = false;
> > > var continueValidation = true;
> > >
> > > return !errors;
> > > }
> > > 
> > >
> > > It's like the validation framework is not detecting the fields.
> > >
> > > Regards,
> > >
> > > Nestor Boscan
> > >
> > >
> >
>


Re: S2: Not generating javascript validation

2013-09-22 Thread Chris Pratt
I believe one of the recent changes was to change the default to disabling
DMI, but you can re-enable it if you understand the risks.
  (*Chris*)


On Sat, Sep 21, 2013 at 6:20 PM, Néstor Boscán  wrote:

> Hi
>
>  validate="true">
> 
>  cssClass="mystyle1"/>
>  cssClass="mystyle1"/>
> 
>
> It looks like this version of Struts 2 doesn't like the Dynamic Method
> Invocation in login!login.action. If I don't use DMI it works. Older
> versions of the framework worked with DMI.
>
> Regards,
>
> Néstor
>
>
> On Sat, Sep 21, 2013 at 5:24 PM,  wrote:
>
> > Can you provide the jsp snipset for the form?
> > Sent via BlackBerry from T-Mobile
> >
> > -Original Message-
> > From: Néstor Boscán 
> > Date: Sat, 21 Sep 2013 16:15:23
> > To: Struts Users Mailing List
> > Reply-To: "Struts Users Mailing List" 
> > Subject: S2: Not generating javascript validation
> >
> > Hi
> >
> > I'm using the latest 2.3.15.2 version of struts 2 on weblogic 10.3.6.
> This
> > are my files:
> >
> > LoginAction-validation.xml:
> >
> >  > "-//Apache Struts//XWork Validator 1.0.3//EN"
> > "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd";>
> > 
> >   
> > 
> >   El usuario es requerido
> > 
> >   
> >   
> > 
> >   La contrasenia es requerida
> > 
> >   
> > 
> >
> > validators.xml:
> >
> > 
> >  > "-//Apache Struts//XWork Validator Definition 1.0//EN"
> > "
> http://struts.apache.org/dtds/xwork-validator-definition-1.0.dtd
> > ">
> > 
> >  >
> >
> class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/>
> >  >
> >
> class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/>
> >  >
> >
> class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/>
> >  >
> >
> class="com.opensymphony.xwork2.validator.validators.LongRangeFieldValidator"/>
> >  >
> >
> class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/>
> >  >
> >
> class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/>
> >  >
> >
> class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/>
> >  >
> class="com.opensymphony.xwork2.validator.validators.ExpressionValidator"/>
> >  >
> >
> class="com.opensymphony.xwork2.validator.validators.FieldExpressionValidator"/>
> >  > class="com.opensymphony.xwork2.validator.validators.EmailValidator"/>
> >  > class="com.opensymphony.xwork2.validator.validators.URLValidator"/>
> >  >
> >
> class="com.opensymphony.xwork2.validator.validators.VisitorFieldValidator"/>
> >  >
> >
> class="com.opensymphony.xwork2.validator.validators.ConversionErrorFieldValidator"/>
> >  >
> >
> class="com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator"/>
> >  >
> class="com.opensymphony.xwork2.validator.validators.RegexFieldValidator"/>
> >  >
> >
> class="com.opensymphony.xwork2.validator.validators.ConditionalVisitorFieldValidator"/>
> > 
> >
> > The form tag has validate="true".
> >
> > When I generate the login page I get:
> >
> > 
> > function validateForm_login() {
> > var getFieldValue = function(field) {
> > var type = field.type ? field.type : field[0].type;
> > if (type == 'select-one' || type == 'select-multiple') {
> > return (field.selectedIndex == -1 ? "" :
> > field.options[field.selectedIndex].value);
> > } else if (type == 'checkbox' || type == 'radio') {
> > if (!field.length) {
> > field = [field];
> > }
> > for (var i = 0; i < field.length; i++) {
> > if (field[i].checked) {
> > return field[i].value;
> > }
> > }
> > return "";
> > }
> > return field.value;
> > }
> > form = document.getElementById("login");
> > clearErrorMessages(form);
> > clearErrorLabels(form);
> >
> > var errors = false;
> > var continueValidation = true;
> >
> > return !errors;
> > }
> > 
> >
> > It's like the validation framework is not detecting the fields.
> >
> > Regards,
> >
> > Nestor Boscan
> >
> >
>


Re: S2: Not generating javascript validation

2013-09-21 Thread Néstor Boscán
Hi







It looks like this version of Struts 2 doesn't like the Dynamic Method
Invocation in login!login.action. If I don't use DMI it works. Older
versions of the framework worked with DMI.

Regards,

Néstor


On Sat, Sep 21, 2013 at 5:24 PM,  wrote:

> Can you provide the jsp snipset for the form?
> Sent via BlackBerry from T-Mobile
>
> -Original Message-
> From: Néstor Boscán 
> Date: Sat, 21 Sep 2013 16:15:23
> To: Struts Users Mailing List
> Reply-To: "Struts Users Mailing List" 
> Subject: S2: Not generating javascript validation
>
> Hi
>
> I'm using the latest 2.3.15.2 version of struts 2 on weblogic 10.3.6. This
> are my files:
>
> LoginAction-validation.xml:
>
>  "-//Apache Struts//XWork Validator 1.0.3//EN"
> "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd";>
> 
>   
> 
>   El usuario es requerido
> 
>   
>   
> 
>   La contrasenia es requerida
> 
>   
> 
>
> validators.xml:
>
> 
>  "-//Apache Struts//XWork Validator Definition 1.0//EN"
> "http://struts.apache.org/dtds/xwork-validator-definition-1.0.dtd
> ">
> 
> 
> class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.LongRangeFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/>
>  class="com.opensymphony.xwork2.validator.validators.ExpressionValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.FieldExpressionValidator"/>
>  class="com.opensymphony.xwork2.validator.validators.EmailValidator"/>
>  class="com.opensymphony.xwork2.validator.validators.URLValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.VisitorFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.ConversionErrorFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator"/>
>  class="com.opensymphony.xwork2.validator.validators.RegexFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.ConditionalVisitorFieldValidator"/>
> 
>
> The form tag has validate="true".
>
> When I generate the login page I get:
>
> 
> function validateForm_login() {
> var getFieldValue = function(field) {
> var type = field.type ? field.type : field[0].type;
> if (type == 'select-one' || type == 'select-multiple') {
> return (field.selectedIndex == -1 ? "" :
> field.options[field.selectedIndex].value);
> } else if (type == 'checkbox' || type == 'radio') {
> if (!field.length) {
> field = [field];
> }
> for (var i = 0; i < field.length; i++) {
> if (field[i].checked) {
> return field[i].value;
> }
> }
> return "";
> }
> return field.value;
> }
> form = document.getElementById("login");
> clearErrorMessages(form);
> clearErrorLabels(form);
>
> var errors = false;
> var continueValidation = true;
>
> return !errors;
> }
> 
>
> It's like the validation framework is not detecting the fields.
>
> Regards,
>
> Nestor Boscan
>
>


Re: S2: Not generating javascript validation

2013-09-21 Thread Néstor Boscán
Hi







Thanks for the help



On Sat, Sep 21, 2013 at 5:24 PM,  wrote:

> Can you provide the jsp snipset for the form?
> Sent via BlackBerry from T-Mobile
>
> -Original Message-
> From: Néstor Boscán 
> Date: Sat, 21 Sep 2013 16:15:23
> To: Struts Users Mailing List
> Reply-To: "Struts Users Mailing List" 
> Subject: S2: Not generating javascript validation
>
> Hi
>
> I'm using the latest 2.3.15.2 version of struts 2 on weblogic 10.3.6. This
> are my files:
>
> LoginAction-validation.xml:
>
>  "-//Apache Struts//XWork Validator 1.0.3//EN"
> "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd";>
> 
>   
> 
>   El usuario es requerido
> 
>   
>   
> 
>   La contrasenia es requerida
> 
>   
> 
>
> validators.xml:
>
> 
>  "-//Apache Struts//XWork Validator Definition 1.0//EN"
> "http://struts.apache.org/dtds/xwork-validator-definition-1.0.dtd
> ">
> 
> 
> class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.LongRangeFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/>
>  class="com.opensymphony.xwork2.validator.validators.ExpressionValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.FieldExpressionValidator"/>
>  class="com.opensymphony.xwork2.validator.validators.EmailValidator"/>
>  class="com.opensymphony.xwork2.validator.validators.URLValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.VisitorFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.ConversionErrorFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator"/>
>  class="com.opensymphony.xwork2.validator.validators.RegexFieldValidator"/>
> 
> class="com.opensymphony.xwork2.validator.validators.ConditionalVisitorFieldValidator"/>
> 
>
> The form tag has validate="true".
>
> When I generate the login page I get:
>
> 
> function validateForm_login() {
> var getFieldValue = function(field) {
> var type = field.type ? field.type : field[0].type;
> if (type == 'select-one' || type == 'select-multiple') {
> return (field.selectedIndex == -1 ? "" :
> field.options[field.selectedIndex].value);
> } else if (type == 'checkbox' || type == 'radio') {
> if (!field.length) {
> field = [field];
> }
> for (var i = 0; i < field.length; i++) {
> if (field[i].checked) {
> return field[i].value;
> }
> }
> return "";
> }
> return field.value;
> }
> form = document.getElementById("login");
> clearErrorMessages(form);
> clearErrorLabels(form);
>
> var errors = false;
> var continueValidation = true;
>
> return !errors;
> }
> 
>
> It's like the validation framework is not detecting the fields.
>
> Regards,
>
> Nestor Boscan
>
>


Re: S2: Not generating javascript validation

2013-09-21 Thread jlmagc
Can you provide the jsp snipset for the form?
Sent via BlackBerry from T-Mobile

-Original Message-
From: Néstor Boscán 
Date: Sat, 21 Sep 2013 16:15:23 
To: Struts Users Mailing List
Reply-To: "Struts Users Mailing List" 
Subject: S2: Not generating javascript validation

Hi

I'm using the latest 2.3.15.2 version of struts 2 on weblogic 10.3.6. This
are my files:

LoginAction-validation.xml:

http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd";>

  

  El usuario es requerido

  
  

  La contrasenia es requerida

  


validators.xml:


http://struts.apache.org/dtds/xwork-validator-definition-1.0.dtd";>



















The form tag has validate="true".

When I generate the login page I get:


function validateForm_login() {
var getFieldValue = function(field) {
var type = field.type ? field.type : field[0].type;
if (type == 'select-one' || type == 'select-multiple') {
return (field.selectedIndex == -1 ? "" :
field.options[field.selectedIndex].value);
} else if (type == 'checkbox' || type == 'radio') {
if (!field.length) {
field = [field];
}
for (var i = 0; i < field.length; i++) {
if (field[i].checked) {
return field[i].value;
}
}
return "";
}
return field.value;
}
form = document.getElementById("login");
clearErrorMessages(form);
clearErrorLabels(form);

var errors = false;
var continueValidation = true;

return !errors;
}


It's like the validation framework is not detecting the fields.

Regards,

Nestor Boscan



S2: Not generating javascript validation

2013-09-21 Thread Néstor Boscán
Hi

I'm using the latest 2.3.15.2 version of struts 2 on weblogic 10.3.6. This
are my files:

LoginAction-validation.xml:

http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd";>

  

  El usuario es requerido

  
  

  La contrasenia es requerida

  


validators.xml:


http://struts.apache.org/dtds/xwork-validator-definition-1.0.dtd";>



















The form tag has validate="true".

When I generate the login page I get:


function validateForm_login() {
var getFieldValue = function(field) {
var type = field.type ? field.type : field[0].type;
if (type == 'select-one' || type == 'select-multiple') {
return (field.selectedIndex == -1 ? "" :
field.options[field.selectedIndex].value);
} else if (type == 'checkbox' || type == 'radio') {
if (!field.length) {
field = [field];
}
for (var i = 0; i < field.length; i++) {
if (field[i].checked) {
return field[i].value;
}
}
return "";
}
return field.value;
}
form = document.getElementById("login");
clearErrorMessages(form);
clearErrorLabels(form);

var errors = false;
var continueValidation = true;

return !errors;
}


It's like the validation framework is not detecting the fields.

Regards,

Nestor Boscan


Re: JavaScript errors on exception-handling.html

2013-09-05 Thread Chris
Hallo Volker, 

Thanks, 
I was writing this in the same time 

Some HTML pages in WW/docs give sometimes an ( alert? ) error 
and yon can't see the data 
For example, Coding Struts 2 Actions, docs/WW/docs/coding-struts-2-actions.html,

The same error:
--
    SyntaxHighlighter
    Can't find brush for: xml
-    

THe data , in a script syntax  like this one :
---
&lt;![CDATA[

&amp;lt;action name="hello" 
class="org.apache.struts.helloworld.action.HelloWorldAction" 
method="execute"&amp;gt;
    &amp;lt;result name="success"&amp;gt;/HelloWorld.jsp&amp;lt;/result&amp;gt;
&amp;lt;/action&amp;gt;

]]&gt;



What about ? 





 De : Volker Krebs 
À : Struts Users Mailing List  
Envoyé le : Jeudi 5 septembre 2013 9h08
Objet : JavaScript errors on exception-handling.html
 

Hello,
the Exception Handling Documentation Page
<http://struts.apache.org/release/2.3.x/docs/exception-handling.html>
has some JavaScript Errors.

I stumbled over this a couple of weeks ago ... and now again. So I thought I'll 
write it to the list, hoping to reach someone who can fix it.

Regards


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

Re: JavaScript errors on exception-handling.html

2013-09-05 Thread Lukasz Lenart
Yes, we know that and it's already solved - please check the Draft docs

http://struts.apache.org/development/2.x/docs/exception-handling.html


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

2013/9/5 Volker Krebs :
> Hello,
> the Exception Handling Documentation Page
> <http://struts.apache.org/release/2.3.x/docs/exception-handling.html>
> has some JavaScript Errors.
>
> I stumbled over this a couple of weeks ago ... and now again. So I thought
> I'll write it to the list, hoping to reach someone who can fix it.
>
> Regards
>
>
> -
> 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



JavaScript errors on exception-handling.html

2013-09-05 Thread Volker Krebs

Hello,
the Exception Handling Documentation Page
<http://struts.apache.org/release/2.3.x/docs/exception-handling.html>
has some JavaScript Errors.

I stumbled over this a couple of weeks ago ... and now again. So I 
thought I'll write it to the list, hoping to reach someone who can fix it.


Regards


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



Re: Struts Javascript error

2013-08-12 Thread Sreekanth S. Nair
Javscript error got resolved by adding  between html  tag.
but still i'm unable to see the field error message which i have added
using addFieldError() method.

Sreekanth S. Nair  wrote:

> Hi,
>  Getting the following error in javascript console, happening with latest
> struts2 distribution
>
>
>1. Uncaught ReferenceError: StrutsUtils is not defined
>
> validation.js:161<http://localhost:8080/tradelicense/struts/css_xhtml/validation.js>
> <http://localhost:8080/tradelicense/struts/css_xhtml/validation.js>
>
>
> Due to this or not, non of the action error messages are getting
> displayed.
> --
> Thanks & Regards
> Srikanth
>


Struts Javascript error

2013-08-12 Thread Sreekanth S. Nair
Hi,
 Getting the following error in javascript console, happening with latest
struts2 distribution


   1. Uncaught ReferenceError: StrutsUtils is not defined
validation.js:161<http://localhost:8080/tradelicense/struts/css_xhtml/validation.js>
   <http://localhost:8080/tradelicense/struts/css_xhtml/validation.js>


Due to this or not, non of the action error messages are getting displayed.
-- 
Thanks & Regards
Srikanth


Re: sj:tabbedpanel javascript

2013-08-09 Thread john lee
view source
 
the related option for jquery(after sj_query convert into jquery), it shows 
following  
 
 jQuery(document).ready(function () {  
 var options_partmoreinfo = {}; 
 options_partmoreinfo.jqueryaction = "tabbedpanel";  
 options_partmoreinfo.id = "partmoreinfo";  
 options_partmoreinfo.oncom = "tabcomplete";  
 options_partmoreinfo.oncha = "tabchange";
 jQuery.struts2_jquery_ui.bind(jQuery('#partmoreinfo'),options_partmoreinfo);   
 
 }); 
<script type='text/javascript'>jQuery(document).ready(function () {  var 
options_partmoreinfo = {};  options_partmoreinfo.jqueryaction = "tabbedpanel";  
options_partmoreinfo.id = "partmoreinfo";  options_partmoreinfo.oncom = 
"tabcomplete";  options_partmoreinfo.oncha = "tabchange";  
jQuery.struts2_jquery_ui.bind(jQuery('#partmoreinfo'),options_partmoreinfo);   
}); 
  
that is why i use the following
 
    $('#partmoreinfo').tabs("selectedTab", "partmoreinfo_id", 3);
 or 
   $("#partmoreinfo").tabs( "taboptions", "partmoreinfo_id", 3);
 
to access the attribute selectedTab of sj:tabbedpanel's attrubte "selectedTab", 
but not working.
 

>        
>        
>        
>         Accessories here 
>         Replacement Parts here 
>         Cross Reference here 
>   
 
Please advise
 
thanks again
 
john
     
 


 From: Chris Pratt 
To: john lee  
Cc: Struts Users Mailing List  
Sent: Friday, August 9, 2013 1:27 PM
Subject: Re: sj:tabbedpanel javascript
  

I have no idea what you mean.  The sj:tabbedpanel generates HTML Elements
and some jQuery based JavaScript.  It'll all be there in the source.
What's not "match"ing?
  (*Chris*)


On Fri, Aug 9, 2013 at 11:00 AM, john lee  wrote:

> thanks for reply,
>
> i did view source before ask question here, but sj:tabbedpanel convert
> into jquery, even view source, still not match.
>
> john
>
>    *From:* Chris Pratt 
> *To:* Struts Users Mailing List ; john lee <
> sh_thorn_b...@yahoo.com>
> *Sent:* Friday, August 9, 2013 12:43 PM
> *Subject:* Re: sj:tabbedpanel javascript
>
> Use the "View Source" feature in your browser to see what's being
> generated, then you should be able to see for yourself how to use
> JavaScript to interact with the on-screen components.
>   (*Chris*)
>
>
> On Fri, Aug 9, 2013 at 10:25 AM, john lee  wrote:
>
>
> try to using javascript to set sj:tabbedpanel's attribute, but not working
>
> what is the correct format for access attribute sj:tabbedpanel's
> atrtribute in javascript?
>
> thanks in advance
>
> John
>
>
>
> 
>
> function setpartmoreinfo(id) {
>         $("#Cross").tabs( "option", "partmoreinfo_id", id);
>       }
> 
>
> change display
>
>  
>        
>        
>        
>         Accessories here 
>         Replacement Parts here 
>         Cross Reference here 
>   
>
>
>
>
>

Re: sj:tabbedpanel javascript

2013-08-09 Thread Chris Pratt
I have no idea what you mean.  The sj:tabbedpanel generates HTML Elements
and some jQuery based JavaScript.  It'll all be there in the source.
 What's not "match"ing?
  (*Chris*)


On Fri, Aug 9, 2013 at 11:00 AM, john lee  wrote:

> thanks for reply,
>
> i did view source before ask question here, but sj:tabbedpanel convert
> into jquery, even view source, still not match.
>
> john
>
>*From:* Chris Pratt 
> *To:* Struts Users Mailing List ; john lee <
> sh_thorn_b...@yahoo.com>
> *Sent:* Friday, August 9, 2013 12:43 PM
> *Subject:* Re: sj:tabbedpanel javascript
>
> Use the "View Source" feature in your browser to see what's being
> generated, then you should be able to see for yourself how to use
> JavaScript to interact with the on-screen components.
>   (*Chris*)
>
>
> On Fri, Aug 9, 2013 at 10:25 AM, john lee  wrote:
>
>
> try to using javascript to set sj:tabbedpanel's attribute, but not working
>
> what is the correct format for access attribute sj:tabbedpanel's
> atrtribute in javascript?
>
> thanks in advance
>
> John
>
>
>
> 
>
> function setpartmoreinfo(id) {
> $("#Cross").tabs( "option", "partmoreinfo_id", id);
>   }
> 
>
> change display
>
>  
>
>
>
> Accessories here 
> Replacement Parts here 
> Cross Reference here 
>   
>
>
>
>
>


Re: sj:tabbedpanel javascript

2013-08-09 Thread john lee
thanks for reply,
 
i did view source before ask question here, but sj:tabbedpanel convert into 
jquery, even view source, still not match.
 
john
 


 From: Chris Pratt 
To: Struts Users Mailing List ; john lee 
 
Sent: Friday, August 9, 2013 12:43 PM
Subject: Re: sj:tabbedpanel javascript
  


Use the "View Source" feature in your browser to see what's being generated, 
then you should be able to see for yourself how to use JavaScript to interact 
with the on-screen components.
  (*Chris*) 



On Fri, Aug 9, 2013 at 10:25 AM, john lee  wrote:

 
>try to using javascript to set sj:tabbedpanel's attribute, but not working
> 
>what is the correct format for access attribute sj:tabbedpanel's atrtribute in 
>javascript?
> 
>thanks in advance
> 
>John
> 
> 
> 
>
> 
>function setpartmoreinfo(id) {
>    $("#Cross").tabs( "option", "partmoreinfo_id", id); 
>  }
>
> 
>change display
> 
> 
>   
>   
>   
>    Accessories here 
>    Replacement Parts here 
>    Cross Reference here 
>  

Re: sj:tabbedpanel javascript

2013-08-09 Thread Chris Pratt
Use the "View Source" feature in your browser to see what's being
generated, then you should be able to see for yourself how to use
JavaScript to interact with the on-screen components.
  (*Chris*)


On Fri, Aug 9, 2013 at 10:25 AM, john lee  wrote:

>
> try to using javascript to set sj:tabbedpanel's attribute, but not working
>
> what is the correct format for access attribute sj:tabbedpanel's
> atrtribute in javascript?
>
> thanks in advance
>
> John
>
>
>
> 
>
> function setpartmoreinfo(id) {
> $("#Cross").tabs( "option", "partmoreinfo_id", id);
>   }
> 
>
> change display
>
>  
>
>
>
> Accessories here 
> Replacement Parts here 
> Cross Reference here 
>   


sj:tabbedpanel javascript

2013-08-09 Thread john lee
 
try to using javascript to set sj:tabbedpanel's attribute, but not working
 
what is the correct format for access attribute sj:tabbedpanel's atrtribute in 
javascript?
 
thanks in advance
 
John
 
 
 

 
function setpartmoreinfo(id) {
    $("#Cross").tabs( "option", "partmoreinfo_id", id); 
  }

 
change display
 
 
   
   
   
    Accessories here 
    Replacement Parts here 
    Cross Reference here 
  

Re: [jira] [Resolved] (WW-3980) javascript Error : Dojo is undefined

2013-02-14 Thread Lukasz Lenart
Hi,

You must map also Struts2 related resources as you limited filter
mapping just to *.action. The simplest way to check what else has to
be mapped is return to default mapping (/*) and check with browser
what other resources are fetched, eg. /struts*, /static*


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Fwd: [jira] [Resolved] (WW-3980) javascript Error : Dojo is undefined

2013-02-14 Thread prashant borse
Hi,
I am stuck in this problem since last 3 days. can you please look into this.
As per my analysis, Due to both struts1 and struts2 framework used in the
application causing conflict situations and resulting in problems in
implementing UI for the File uploading functionality. Below is my analysis
for the same.

 In my aplication. Struts 1 servlet mapping and Struts 2 filter mapping
configured in such a way as to cause both to be invoked on the same
request. Since multi-part request parsing is handled by Struts, not the
container, this is causing a conflict which in turn receives NULL value for
the FormFile. To solve this problem I have chnaged struts2 filter mapping
from "/*"  to  "*.action"  which has solved my problem but created other
one for Struts2.

one of the struts2 page encountered a java script error message "dojo
is undifined". I have done analysis and come to the conclusion that struts2
contains static files (the Dojo libraries, in this case), and expects to
see *every* request, so it can serve those files. so the struts2 filter
mapping must be "/*" and if we convert accordingly, my fileuploading
functionality wont work as i explained above.

 here I have cought in conflict situation. Request you to suggest me what
action needs to be taken on this.

Also please look into mail below for more details
Regards,
Prashant

-- Forwarded message --
From: Lukasz Lenart (JIRA) 
Date: Wed, Feb 13, 2013 at 10:14 PM
Subject: [jira] [Resolved] (WW-3980) javascript Error : Dojo is undefined
To: prashant.bo...@gmail.com



 [
https://issues.apache.org/jira/browse/WW-3980?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]

Lukasz Lenart resolved WW-3980.
---

Resolution: Not A Problem

Please first ask question on the "Struts Users Mailing List" <
user@struts.apache.org> before registering an issue like this.

> javascript Error : Dojo is undefined
> 
>
> Key: WW-3980
> URL: https://issues.apache.org/jira/browse/WW-3980
> Project: Struts 2
>  Issue Type: Bug
>  Components: Core Actions
>Affects Versions: 2.0.14
> Environment: Windows
>    Reporter: prashant borse
>Priority: Blocker
>  Labels: javascript
> Fix For: Future
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Hi,
> My application is using both, in one module struts1 and in other module
struts2. i have to do file uploading in struts1 but due to struts2 filter
mapping   as given below
>  
> struts2
> /*
> 
> Struts1 considering the multipart request as the http request, so i am
getting the FormFile always Null. To solve this problem, I have changed
*.action, Now my problem of file uploading is
solve, But it has created new problem in struts2 module. while travercing
the module, I got the javascript exception "Dojo is undefined". I am not
getting any solution to solve this problem. i can not convert back
url-pattern to /* if I do this then my file uploding will not work.
> Request you to send me solution As early as possible

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA
administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


Re: [Struts2] SessionToken Interceptor used with json Result and Javascript Calls

2012-11-07 Thread Ken McWilliams
Can you share the interceptor stack configuration for your normal JSP's and
the stack configuration for the json actions?


On Wed, Nov 7, 2012 at 5:37 AM, Jan Fröhlich wrote:

> Hi...
>
> I try to secure one of my web applications with tokens.
> Everything works fine with basic jsp pages. But in one case, I call an
> action from javascript via jquery.ajax and return a json result.
>
> To do that, I added two properties to the json result object
> (documenTable) with token and tokenName and populate them in the action with
> documentTable.setTokenName(TokenHelper.getTokenName());
> documentTable.setToken(TokenHelper.getToken());
>
> The Javascript that gets the result object (data) looks like this:
> var submitData = {
> documentID : documentRow.documentID,
> showMessage : true
> };
> submitData[data.tokenName] = data.token;
> tdName.bind("click", function() {
> $.ajax({
> url : "view",
> type: 'POST',
> data : submitData,
> success : function() {
> ...
> }
> });
>
> When the click event is fired, the parameters struts.token.name and
> struts.token are submitted with the request but the action returns
> invalid.token.
>
> Is that a way I can go? Is the TokenHelper the right thing to get a new
> valid token from?
>
> Any hints welcome!
>
> Regards
> Jan
>
>


[Struts2] SessionToken Interceptor used with json Result and Javascript Calls

2012-11-07 Thread Jan Fröhlich
Hi...

I try to secure one of my web applications with tokens.
Everything works fine with basic jsp pages. But in one case, I call an action 
from javascript via jquery.ajax and return a json result.

To do that, I added two properties to the json result object (documenTable) 
with token and tokenName and populate them in the action with
documentTable.setTokenName(TokenHelper.getTokenName());
documentTable.setToken(TokenHelper.getToken());

The Javascript that gets the result object (data) looks like this:
var submitData = {
documentID : documentRow.documentID,
showMessage : true
};
submitData[data.tokenName] = data.token;
tdName.bind("click", function() {
$.ajax({
url : "view",
type: 'POST',
data : submitData,
success : function() {
...
}
});

When the click event is fired, the parameters struts.token.name and 
struts.token are submitted with the request but the action returns 
invalid.token.

Is that a way I can go? Is the TokenHelper the right thing to get a new valid 
token from?

Any hints welcome!

Regards
Jan



Re: How does struts 2 and struts2 jquery includes javascript files in a jsp from their jar files

2012-07-02 Thread Łukasz Lenart
2012/6/30 Anandraj :
> Hi,
>
> we are using struts2 with struts2 jquery in our application and i
> have noticed Struts2 and Struts2-jquery includes the javascripts files from
> the jar by including the tag of the framework. how it included the
> javascript file by including the tag ,is there any way to manually include
> the javascript files if we wants to 

You mist implement your own version of StaticContentLoader interface
and add it to struts.xml as below:




Take a look on DefaultStaticContentLoader implementation.

Regards
-- 
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

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



How does struts 2 and struts2 jquery includes javascript files in a jsp from their jar files

2012-06-30 Thread Anandraj

Hi,

we are using struts2 with struts2 jquery in our application and 
i have noticed Struts2 and Struts2-jquery includes the javascripts files 
from the jar by including the tag of the framework. how it included the 
javascript file by including the tag ,is there any way to manually 
include the javascript files if we wants to 



thanks in advanced

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



Re: Doest struts 2 accept “POST” method to send data from javascript to an Action server?

2011-12-16 Thread Dave Newton
Please follow up on your stackoverflow post as well. You need to provide
more information when you ask your questions there.

On Fri, Dec 16, 2011 at 9:28 AM, José Manuel Sendín Cruz <
jmanuel.sendin.c...@gmail.com> wrote:

> Solved. My mistake by sending wrong datatype. Content-Type must be
> application/x-www-form-urlencoded.
>
> Thank you.
>
> 2011/12/16 José Manuel Sendín Cruz 
>
> > Hello Maurizio, thanks.
> >
> > Headers sended as "GET" are:
> >
> > Host localhost:8080User-AgentMozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0)
> > Gecko/20100101 Firefox/8.0 Acceptapplication/json, text/javascript, */*;
> > q=0.01 Accept-Languagees-es,es;q=0.8,en-us;q=0.5,en;q=0.3
> Accept-Encodinggzip,
> > deflateAccept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7Connection keep-alive
> > Content-Typeapplication/json; charset=utf-8
> X-Requested-WithXMLHttpRequest
> > Refererhttp://localhost:8080/Aplicacion/prueba.jsp Cookie
> > JSESSIONID=A650C235C78B2657B14534363D938F80
> >
> > And parameters are sended as:
> >
> > customData someinfojgGridData[{"id":"1","direccion":"Calle del Pardo
> > 3","nombre":"Paco1"},{"id":"2","direccion":"Calle del Pardo
> 2","nombre":"Paco2"},{"id":"3","direccion":"Calle
> > del Pardo 1","nombre":"Paco3"}]
> > So, it seems be ok. Not as POST:
> >
> >
> > Headers sended as "POST" are:
> > Hostlocalhost:8080User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0)
> > Gecko/20100101 Firefox/8.0Accept application/json, text/javascript, */*;
> > q=0.01Accept-Languagees-es,es;q=0.8,en-us;q=0.5,en;q=0.3
> Accept-Encodinggzip,
> > deflate Accept-CharsetISO-8859-1,utf-8;q=0.7,*;q=0.7Connection keep-alive
> > Content-Typeapplication/json; charset=utf-8
> X-Requested-WithXMLHttpRequest
> > Refererhttp://localhost:8080/AplicacionDiet99/prueba.jsp
> Content-Length334
> > CookieJSESSIONID=A650C235C78B2657B14534363D938F80
> > And parameters!!!:
> >
> >
> >
> jgGridData=%5B%7B%22id%22%3A%221%22%2C%22direccion%22%3A%22Calle+del+Pardo+3%22%2C%22nombre%22%3A%22Paco1
> >
> %22%7D%2C%7B%22id%22%3A%222%22%2C%22direccion%22%3A%22Calle+del+Pardo+2%22%2C%22nombre%22%3A%22Paco2
> >
> %22%7D%2C%7B%22id%22%3A%223%22%2C%22direccion%22%3A%22Calle+del+Pardo+1%22%2C%22nombre%22%3A%22Paco3
> > %22%7D%5D&customData=someinfo
> >
> > So, you might be right. How can I send as GET format by POST method?
> >
> >
> >
> > 2011/12/16 Maurizio Cucchiara 
> >
> >> I'm not sure, but if I recall correctly that could be an encoding issue.
> >> In such case firebug plugin or chrome console might be very usefull.
> >>
> >> Sent from my mobile device, so please excuse typos and brevity.
> >>
> >> Maurizio Cucchiara
> >>
> >> Il giorno 16/dic/2011 12.23, "José Manuel Sendín Cruz" <
> >> jmanuel.sendin.c...@gmail.com> ha scritto:
> >>
> >> > [I tried to simplifie the code to better understand the
> questions]When I
> >> > tried to send data from a web side client to an ActionClass in Struts
> 2
> >> > like:
> >> >
> >> > CLIENT SIDE:
> >> > -
> >> >jQuery("#bedata").click(function(){ //Function for button "bedata"
> >> >
> >> > var postData = "SOME DATA TO SEND"
> >> >
> >> >//Sendin data:
> >> >$.ajax({
> >> >type: "POST", //Method to send the data. I would need "post"
> >> method
> >> > as better option.
> >> >url: "GuardaFila.action", //Action called to data treatament
> >> >data : {
> >> >jgGridData: postData, //PARAMETER jgGrdData with variable
> >> > "postData" value
> >> >customData: "someinfo" //Just another parameter called
> >> > "customData" with more data,
> >> >},
> >> >
> >> >
> >> >/** START: handlers for request. Not important for this trouble **/
> >> >dataType:"json",
> >> >contentType: "application/json; charset=utf-8",
> >> >success: function(response, textStatus, xhr) {
> >> >alert("success");
> >> &g

Re: Doest struts 2 accept “POST” method to send data from javascript to an Action server?

2011-12-16 Thread José Manuel Sendín Cruz
Solved. My mistake by sending wrong datatype. Content-Type must be
application/x-www-form-urlencoded.

Thank you.

2011/12/16 José Manuel Sendín Cruz 

> Hello Maurizio, thanks.
>
> Headers sended as "GET" are:
>
> Host localhost:8080User-AgentMozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0)
> Gecko/20100101 Firefox/8.0 Acceptapplication/json, text/javascript, */*;
> q=0.01 Accept-Languagees-es,es;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encodinggzip,
> deflateAccept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7Connection keep-alive
> Content-Typeapplication/json; charset=utf-8 X-Requested-WithXMLHttpRequest
> Refererhttp://localhost:8080/Aplicacion/prueba.jsp Cookie
> JSESSIONID=A650C235C78B2657B14534363D938F80
>
> And parameters are sended as:
>
> customData someinfojgGridData[{"id":"1","direccion":"Calle del Pardo
> 3","nombre":"Paco1"},{"id":"2","direccion":"Calle del Pardo 
> 2","nombre":"Paco2"},{"id":"3","direccion":"Calle
> del Pardo 1","nombre":"Paco3"}]
> So, it seems be ok. Not as POST:
>
>
> Headers sended as "POST" are:
> Hostlocalhost:8080User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0)
> Gecko/20100101 Firefox/8.0Accept application/json, text/javascript, */*;
> q=0.01Accept-Languagees-es,es;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encodinggzip,
> deflate Accept-CharsetISO-8859-1,utf-8;q=0.7,*;q=0.7Connection keep-alive
> Content-Typeapplication/json; charset=utf-8 X-Requested-WithXMLHttpRequest
> Refererhttp://localhost:8080/AplicacionDiet99/prueba.jsp Content-Length334
> CookieJSESSIONID=A650C235C78B2657B14534363D938F80
> And parameters!!!:
>
>
> jgGridData=%5B%7B%22id%22%3A%221%22%2C%22direccion%22%3A%22Calle+del+Pardo+3%22%2C%22nombre%22%3A%22Paco1
> %22%7D%2C%7B%22id%22%3A%222%22%2C%22direccion%22%3A%22Calle+del+Pardo+2%22%2C%22nombre%22%3A%22Paco2
> %22%7D%2C%7B%22id%22%3A%223%22%2C%22direccion%22%3A%22Calle+del+Pardo+1%22%2C%22nombre%22%3A%22Paco3
> %22%7D%5D&customData=someinfo
>
> So, you might be right. How can I send as GET format by POST method?
>
>
>
> 2011/12/16 Maurizio Cucchiara 
>
>> I'm not sure, but if I recall correctly that could be an encoding issue.
>> In such case firebug plugin or chrome console might be very usefull.
>>
>> Sent from my mobile device, so please excuse typos and brevity.
>>
>> Maurizio Cucchiara
>>
>> Il giorno 16/dic/2011 12.23, "José Manuel Sendín Cruz" <
>> jmanuel.sendin.c...@gmail.com> ha scritto:
>>
>> > [I tried to simplifie the code to better understand the questions]When I
>> > tried to send data from a web side client to an ActionClass in Struts 2
>> > like:
>> >
>> > CLIENT SIDE:
>> > -
>> >jQuery("#bedata").click(function(){ //Function for button "bedata"
>> >
>> > var postData = "SOME DATA TO SEND"
>> >
>> >//Sendin data:
>> >$.ajax({
>> >type: "POST", //Method to send the data. I would need "post"
>> method
>> > as better option.
>> >url: "GuardaFila.action", //Action called to data treatament
>> >data : {
>> >jgGridData: postData, //PARAMETER jgGrdData with variable
>> > "postData" value
>> >customData: "someinfo" //Just another parameter called
>> > "customData" with more data,
>> >},
>> >
>> >
>> >/** START: handlers for request. Not important for this trouble **/
>> >dataType:"json",
>> >contentType: "application/json; charset=utf-8",
>> >success: function(response, textStatus, xhr) {
>> >alert("success");
>> > },
>> >error: function(xhr, textStatus, errorThrown) {
>> >alert("error");
>> >}
>> >/** END: handlers for the request. **/
>> >});
>> >});
>> >
>> >
>> > --
>> >
>> >
>> > I wanted to autofill "jgGridData" and "customData" attributes from
>> > ActionClass that is called when "CargaTabla.action" is invoked. But if
>> type
>> > is POST, it doesnt work.
>> > Just changing POST type in ajax type of sending, turning on "GET", it
>> works
>> > fine. The 

Re: Doest struts 2 accept “POST” method to send data from javascript to an Action server?

2011-12-16 Thread José Manuel Sendín Cruz
Hello Maurizio, thanks.

Headers sended as "GET" are:

Hostlocalhost:8080User-AgentMozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0)
Gecko/20100101 Firefox/8.0Acceptapplication/json, text/javascript, */*;
q=0.01Accept-Languagees-es,es;q=0.8,en-us;q=0.5,en;q=0.3Accept-Encodinggzip,
deflateAccept-CharsetISO-8859-1,utf-8;q=0.7,*;q=0.7Connectionkeep-alive
Content-Typeapplication/json; charset=utf-8X-Requested-WithXMLHttpRequest
Refererhttp://localhost:8080/Aplicacion/prueba.jspCookie
JSESSIONID=A650C235C78B2657B14534363D938F80

And parameters are sended as:

customDatasomeinfojgGridData[{"id":"1","direccion":"Calle del Pardo
3","nombre":"Paco1"},{"id":"2","direccion":"Calle del Pardo
2","nombre":"Paco2"},{"id":"3","direccion":"Calle
del Pardo 1","nombre":"Paco3"}]
So, it seems be ok. Not as POST:


Headers sended as "POST" are:
Hostlocalhost:8080User-AgentMozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0)
Gecko/20100101 Firefox/8.0Acceptapplication/json, text/javascript, */*;
q=0.01Accept-Languagees-es,es;q=0.8,en-us;q=0.5,en;q=0.3Accept-Encodinggzip,
deflateAccept-CharsetISO-8859-1,utf-8;q=0.7,*;q=0.7Connectionkeep-alive
Content-Typeapplication/json; charset=utf-8X-Requested-WithXMLHttpRequest
Refererhttp://localhost:8080/AplicacionDiet99/prueba.jspContent-Length334
CookieJSESSIONID=A650C235C78B2657B14534363D938F80
And parameters!!!:

jgGridData=%5B%7B%22id%22%3A%221%22%2C%22direccion%22%3A%22Calle+del+Pardo+3%22%2C%22nombre%22%3A%22Paco1
%22%7D%2C%7B%22id%22%3A%222%22%2C%22direccion%22%3A%22Calle+del+Pardo+2%22%2C%22nombre%22%3A%22Paco2
%22%7D%2C%7B%22id%22%3A%223%22%2C%22direccion%22%3A%22Calle+del+Pardo+1%22%2C%22nombre%22%3A%22Paco3
%22%7D%5D&customData=someinfo

So, you might be right. How can I send as GET format by POST method?


2011/12/16 Maurizio Cucchiara 

> I'm not sure, but if I recall correctly that could be an encoding issue.
> In such case firebug plugin or chrome console might be very usefull.
>
> Sent from my mobile device, so please excuse typos and brevity.
>
> Maurizio Cucchiara
>
> Il giorno 16/dic/2011 12.23, "José Manuel Sendín Cruz" <
> jmanuel.sendin.c...@gmail.com> ha scritto:
>
> > [I tried to simplifie the code to better understand the questions]When I
> > tried to send data from a web side client to an ActionClass in Struts 2
> > like:
> >
> > CLIENT SIDE:
> > -
> >jQuery("#bedata").click(function(){ //Function for button "bedata"
> >
> > var postData = "SOME DATA TO SEND"
> >
> >//Sendin data:
> >$.ajax({
> >type: "POST", //Method to send the data. I would need "post"
> method
> > as better option.
> >url: "GuardaFila.action", //Action called to data treatament
> >data : {
> >jgGridData: postData, //PARAMETER jgGrdData with variable
> > "postData" value
> >customData: "someinfo" //Just another parameter called
> > "customData" with more data,
> >},
> >
> >
> >/** START: handlers for request. Not important for this trouble **/
> >dataType:"json",
> >contentType: "application/json; charset=utf-8",
> >success: function(response, textStatus, xhr) {
> >alert("success");
> > },
> >error: function(xhr, textStatus, errorThrown) {
> >alert("error");
> >}
> >/** END: handlers for the request. **/
> >});
> >});
> >
> >
> > --
> >
> >
> > I wanted to autofill "jgGridData" and "customData" attributes from
> > ActionClass that is called when "CargaTabla.action" is invoked. But if
> type
> > is POST, it doesnt work.
> > Just changing POST type in ajax type of sending, turning on "GET", it
> works
> > fine. The call to CargaTabla.action ActionClass setters methods for the
> > jgGridData and customData has done properly.
> >
> >
> >
> > SERVER SIDE:
> > My struts.xml piece of significant code is:
> >
> > > class="org.json.JSONRespuestaTabla">
> >
> >
> >
> > So, GuardaFila action in its method "guardarUsuario" is properly called
> in
> > debuggin. A simplified version of ActionClass
> (org.json.JSONRespuestaTabla)
> > is:
> >
> > public class JSONRespuestaT

Re: Doest struts 2 accept “POST” method to send data from javascript to an Action server?

2011-12-16 Thread Maurizio Cucchiara
I'm not sure, but if I recall correctly that could be an encoding issue.
In such case firebug plugin or chrome console might be very usefull.

Sent from my mobile device, so please excuse typos and brevity.

Maurizio Cucchiara

Il giorno 16/dic/2011 12.23, "José Manuel Sendín Cruz" <
jmanuel.sendin.c...@gmail.com> ha scritto:

> [I tried to simplifie the code to better understand the questions]When I
> tried to send data from a web side client to an ActionClass in Struts 2
> like:
>
> CLIENT SIDE:
> -
>jQuery("#bedata").click(function(){ //Function for button "bedata"
>
> var postData = "SOME DATA TO SEND"
>
>//Sendin data:
>$.ajax({
>type: "POST", //Method to send the data. I would need "post" method
> as better option.
>url: "GuardaFila.action", //Action called to data treatament
>data : {
>jgGridData: postData, //PARAMETER jgGrdData with variable
> "postData" value
>customData: "someinfo" //Just another parameter called
> "customData" with more data,
>},
>
>
>/** START: handlers for request. Not important for this trouble **/
>dataType:"json",
>contentType: "application/json; charset=utf-8",
>success: function(response, textStatus, xhr) {
>alert("success");
> },
>error: function(xhr, textStatus, errorThrown) {
>alert("error");
>}
>/** END: handlers for the request. **/
>});
>});
>
>
> --
>
>
> I wanted to autofill "jgGridData" and "customData" attributes from
> ActionClass that is called when "CargaTabla.action" is invoked. But if type
> is POST, it doesnt work.
> Just changing POST type in ajax type of sending, turning on "GET", it works
> fine. The call to CargaTabla.action ActionClass setters methods for the
> jgGridData and customData has done properly.
>
>
>
> SERVER SIDE:
> My struts.xml piece of significant code is:
>
> class="org.json.JSONRespuestaTabla">
>
>
>
> So, GuardaFila action in its method "guardarUsuario" is properly called in
> debuggin. A simplified version of ActionClass (org.json.JSONRespuestaTabla)
> is:
>
> public class JSONRespuestaTabla extends ActionSupport{
>
>String jgGridData = "Old data to be refilled from client";
>String customData = "Old data to be refilled from client";
>
>@Override
>public String execute() {
>//Some stuff
>return SUCCESS;
>}
>
>//Getters and Setter of attributes.
>
>public void setJgGridData(String resultado){
>    System.out.append(resultado);
>}
>public String getJgGridData(){
>return this.jgGridData
>}
>public String getCustomData() {
>return customData;
>    }
>public void setCustomData(String customData) {
>this.customData = customData;
>}
>
>//And the method called and defined in struts.xml (properly called)
>public void guardarUsuario(){
>   //Some stuff.
>   return;
>}
>
> Well, so. If Javascript send the parameters in GET mode, SETTERS are
> working nice, and I can get "SOME DATA TO SEND" on my ActionClass
> JSONRespuestaTabla setted automatically, ready to work with. But if
> JavaScript sends this data in POST mode, Struts doesnt call the setters,
> and I am not able to recieve the data into the class that handle the
> action.
>
> How it comes that? I cant understand why it happens.
>
> I am using jquery, json and tiles plugin for struts2.
>
> Thank you for your help.
>


Doest struts 2 accept “POST” method to send data from javascript to an Action server?

2011-12-16 Thread José Manuel Sendín Cruz
[I tried to simplifie the code to better understand the questions]When I
tried to send data from a web side client to an ActionClass in Struts 2
like:

CLIENT SIDE:
-
jQuery("#bedata").click(function(){ //Function for button "bedata"

 var postData = "SOME DATA TO SEND"

//Sendin data:
$.ajax({
type: "POST", //Method to send the data. I would need "post" method
as better option.
url: "GuardaFila.action", //Action called to data treatament
data : {
jgGridData: postData, //PARAMETER jgGrdData with variable
"postData" value
customData: "someinfo" //Just another parameter called
"customData" with more data,
},


/** START: handlers for request. Not important for this trouble **/
dataType:"json",
contentType: "application/json; charset=utf-8",
success: function(response, textStatus, xhr) {
alert("success");
 },
error: function(xhr, textStatus, errorThrown) {
alert("error");
}
/** END: handlers for the request. **/
});
});


--


I wanted to autofill "jgGridData" and "customData" attributes from
ActionClass that is called when "CargaTabla.action" is invoked. But if type
is POST, it doesnt work.
Just changing POST type in ajax type of sending, turning on "GET", it works
fine. The call to CargaTabla.action ActionClass setters methods for the
jgGridData and customData has done properly.



SERVER SIDE:
My struts.xml piece of significant code is:





So, GuardaFila action in its method "guardarUsuario" is properly called in
debuggin. A simplified version of ActionClass (org.json.JSONRespuestaTabla)
is:

public class JSONRespuestaTabla extends ActionSupport{

String jgGridData = "Old data to be refilled from client";
String customData = "Old data to be refilled from client";

@Override
public String execute() {
//Some stuff
return SUCCESS;
}

//Getters and Setter of attributes.

public void setJgGridData(String resultado){
System.out.append(resultado);
}
public String getJgGridData(){
return this.jgGridData
}
public String getCustomData() {
return customData;
}
public void setCustomData(String customData) {
    this.customData = customData;
}

//And the method called and defined in struts.xml (properly called)
public void guardarUsuario(){
   //Some stuff.
   return;
}

Well, so. If Javascript send the parameters in GET mode, SETTERS are
working nice, and I can get "SOME DATA TO SEND" on my ActionClass
JSONRespuestaTabla setted automatically, ready to work with. But if
JavaScript sends this data in POST mode, Struts doesnt call the setters,
and I am not able to recieve the data into the class that handle the action.

How it comes that? I cant understand why it happens.

I am using jquery, json and tiles plugin for struts2.

Thank you for your help.


Re: checking fielderrors into javascript

2011-06-24 Thread Dave Newton
Then your JSP engine is not configured for modern JSP. Fix that first.

Dave
 On Jun 24, 2011 4:13 PM, "Arpan"  wrote:
> Not yet, Actually it shows as a string itself ${theActionProperty}.So I
> dont get the actual value.
>
> On Fri, Jun 24, 2011 at 10:49 PM, Dave Newton 
wrote:
>
>> Let's take a further step back.
>>
>> What do you believe happens if this is your JSP?
>>
>> 
>> 
>> alert("${theActionProperty}");
>> 
>> 
>>
>> Now try it, and see how it compares with your expectations.
>>
>> Dave
>>
>> On Friday, June 24, 2011, Arpan  wrote:
>> > yes right..but i cant use the same in javascript..
>> >
>> > On Fri, Jun 24, 2011 at 10:19 PM, Dave Newton 
>> wrote:
>> >
>> >> On Fri, Jun 24, 2011 at 12:47 PM, Arpan wrote:
>> >> > Can I aceess the field errors in java script?
>> >> > like : document.getElementById("fieldErrors") or how can i get the
>> value?
>> >>
>> >> ...
>> >>
>> >> Let's take a step back: how would you access a simple action property
>> >> in JavaScript, assuming, say, you were doing it on a JSP page?
>> >>
>> >> var foo = "${theActionProperty}";
>> >>
>> >> Correct?
>> >>
>> >> 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
>>
>>


Re: checking fielderrors into javascript

2011-06-24 Thread Arpan
Not yet, Actually it shows  as a string itself  ${theActionProperty}.So I
dont get the actual value.

On Fri, Jun 24, 2011 at 10:49 PM, Dave Newton  wrote:

> Let's take a further step back.
>
> What do you believe happens if this is your JSP?
>
> 
>
>alert("${theActionProperty}");
>
> 
>
> Now try it, and see how it compares with your expectations.
>
> Dave
>
> On Friday, June 24, 2011, Arpan  wrote:
> > yes right..but i cant use the same in javascript..
> >
> > On Fri, Jun 24, 2011 at 10:19 PM, Dave Newton 
> wrote:
> >
> >> On Fri, Jun 24, 2011 at 12:47 PM, Arpan wrote:
> >> > Can I aceess the field errors in java script?
> >> > like : document.getElementById("fieldErrors") or how can i get the
> value?
> >>
> >> ...
> >>
> >> Let's take a step back: how would you access a simple action property
> >> in JavaScript, assuming, say, you were doing it on a JSP page?
> >>
> >> var foo = "${theActionProperty}";
> >>
> >> Correct?
> >>
> >> 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
>
>


Re: checking fielderrors into javascript

2011-06-24 Thread Dave Newton
Let's take a further step back.

What do you believe happens if this is your JSP?



alert("${theActionProperty}");



Now try it, and see how it compares with your expectations.

Dave

On Friday, June 24, 2011, Arpan  wrote:
> yes right..but i cant use the same in javascript..
>
> On Fri, Jun 24, 2011 at 10:19 PM, Dave Newton  wrote:
>
>> On Fri, Jun 24, 2011 at 12:47 PM, Arpan wrote:
>> > Can I aceess the field errors in java script?
>> > like : document.getElementById("fieldErrors") or how can i get the value?
>>
>> ...
>>
>> Let's take a step back: how would you access a simple action property
>> in JavaScript, assuming, say, you were doing it on a JSP page?
>>
>> var foo = "${theActionProperty}";
>>
>> Correct?
>>
>> 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



Re: checking fielderrors into javascript

2011-06-24 Thread Arpan
yes right..but i cant use the same in javascript..

On Fri, Jun 24, 2011 at 10:19 PM, Dave Newton  wrote:

> On Fri, Jun 24, 2011 at 12:47 PM, Arpan wrote:
> > Can I aceess the field errors in java script?
> > like : document.getElementById("fieldErrors") or how can i get the value?
>
> ...
>
> Let's take a step back: how would you access a simple action property
> in JavaScript, assuming, say, you were doing it on a JSP page?
>
> var foo = "${theActionProperty}";
>
> Correct?
>
> Dave
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: checking fielderrors into javascript

2011-06-24 Thread Dave Newton
On Fri, Jun 24, 2011 at 12:47 PM, Arpan wrote:
> Can I aceess the field errors in java script?
> like : document.getElementById("fieldErrors") or how can i get the value?

...

Let's take a step back: how would you access a simple action property
in JavaScript, assuming, say, you were doing it on a JSP page?

var foo = "${theActionProperty}";

Correct?

Dave

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



Re: checking fielderrors into javascript

2011-06-24 Thread Arpan
Can I aceess the field errors in java script?
like : document.getElementById("fieldErrors") or how can i get the value?

On Fri, Jun 24, 2011 at 10:08 PM, Dave Newton  wrote:

> On Friday, June 24, 2011, Arpan  wrote:
> > In my JavaScript method I want to check if the page has got any
> fielderror
> > or messege.
> >
> > How to access these struts2 objects into java script.Any example?
>
> Just write the JavaScript in something (JSP, FreeMarker, etc.) that
> processes server-side code. Or validate via Ajax.
>
> Dave
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: checking fielderrors into javascript

2011-06-24 Thread Dave Newton
On Friday, June 24, 2011, Arpan  wrote:
> In my JavaScript method I want to check if the page has got any fielderror
> or messege.
>
> How to access these struts2 objects into java script.Any example?

Just write the JavaScript in something (JSP, FreeMarker, etc.) that
processes server-side code. Or validate via Ajax.

Dave

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



checking fielderrors into javascript

2011-06-24 Thread Arpan
Hi,

In my JavaScript method I want to check if the page has got any fielderror
or messege.

How to access these struts2 objects into java script.Any example?

Thanks


Re: Html:link Javascript validation

2011-06-21 Thread Dave Newton
The "onclick" attribute should return true/false based on whether or
not the form should be submitted. If there's no "return" keyword, the
form will be submitted regardless of what happens in the onclick
handler.

Dave

On Tue, Jun 21, 2011 at 8:22 AM, Sunil Choppara  wrote:
> Siva,
>
> Don't declare the action path, if u want validate before submitting the form 
> to action class.
>
> Declare the action path in the script itself.
>
> Regards
>
> Sunil
>
> -Original Message-
> From: sivaks75 [mailto:sivakumar.subbura...@verizonwireless.com]
> Sent: Tuesday, June 21, 2011 11:14 AM
> To: user@struts.apache.org
> Subject: Html:link Javascript validation
>
> Hi,
>
> I wanted to perform javascript validation when HTML link is clicked. If
> validation fails, I want to stop the process. In Javascript function, i
> added return false. so that it stops the process.
>
> When I was running the application, after performing the javascript
> validation (though Layout ID is NULL), it throwed alert message and invoked
> the action also which i was not expecting.
>
> How do we stop the process if javascript validation fails?
>
>  target="_blank" paramId="layoutID" paramName="frmEmailLayout"
> paramProperty="layoutID" action="emaillayout.do?function=viewHTML"
> onClick="validateLayout()"> View File as HTML 
>
> function validateLayoutID(){
>        var1 = document.forms[0].layoutID.value;
>
>        if(var1==""){
>                alert("Layout ID cannot be empty");
>                document.forms[0].layoutID.focus();
>                return false;
>        }
> }
>
> Any help appreciated!
>
> Regards,
> Siva
>
> --
> View this message in context: 
> http://struts.1045723.n5.nabble.com/Html-link-Javascript-validation-tp4509339p4509339.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
>
>
> The information contained in this e-mail message and any attachments is 
> confidential, and is intended only for the use of the party to whom it is 
> addressed. This message and any attachments herein are subject to scanning 
> and may be monitored at any time for review.  If you are not the above-named 
> intended recipient, you are hereby notified that any dissemination, copying 
> or disclosure of this communication is strictly prohibited. If you have 
> received this communication in error, please notify XIUS immediately by reply 
> to this message or by telephoning (781) 904-5000, and destroy this message 
> and its attachments, without making any copy or distribution.
>
> -
> 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: Html:link Javascript validation

2011-06-21 Thread Sunil Choppara
Siva,

Don't declare the action path, if u want validate before submitting the form to 
action class.

Declare the action path in the script itself.

Regards

Sunil

-Original Message-
From: sivaks75 [mailto:sivakumar.subbura...@verizonwireless.com]
Sent: Tuesday, June 21, 2011 11:14 AM
To: user@struts.apache.org
Subject: Html:link Javascript validation

Hi,

I wanted to perform javascript validation when HTML link is clicked. If
validation fails, I want to stop the process. In Javascript function, i
added return false. so that it stops the process.

When I was running the application, after performing the javascript
validation (though Layout ID is NULL), it throwed alert message and invoked
the action also which i was not expecting.

How do we stop the process if javascript validation fails?

 View File as HTML 

function validateLayoutID(){
var1 = document.forms[0].layoutID.value;

if(var1==""){
alert("Layout ID cannot be empty");
document.forms[0].layoutID.focus();
return false;
}
}

Any help appreciated!

Regards,
Siva

--
View this message in context: 
http://struts.1045723.n5.nabble.com/Html-link-Javascript-validation-tp4509339p4509339.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


The information contained in this e-mail message and any attachments is 
confidential, and is intended only for the use of the party to whom it is 
addressed. This message and any attachments herein are subject to scanning and 
may be monitored at any time for review.  If you are not the above-named 
intended recipient, you are hereby notified that any dissemination, copying or 
disclosure of this communication is strictly prohibited. If you have received 
this communication in error, please notify XIUS immediately by reply to this 
message or by telephoning (781) 904-5000, and destroy this message and its 
attachments, without making any copy or distribution.

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



Html:link Javascript validation

2011-06-20 Thread sivaks75
Hi,

I wanted to perform javascript validation when HTML link is clicked. If
validation fails, I want to stop the process. In Javascript function, i
added return false. so that it stops the process.

When I was running the application, after performing the javascript
validation (though Layout ID is NULL), it throwed alert message and invoked
the action also which i was not expecting.

How do we stop the process if javascript validation fails?

 View File as HTML 

function validateLayoutID(){
var1 = document.forms[0].layoutID.value;

if(var1==""){
alert("Layout ID cannot be empty");
document.forms[0].layoutID.focus();
return false;
}
}

Any help appreciated!

Regards,
Siva

--
View this message in context: 
http://struts.1045723.n5.nabble.com/Html-link-Javascript-validation-tp4509339p4509339.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: javascript array to Struts 2 action

2011-05-10 Thread Paweł Wielgus
Hi,
try with String[] field in your action,
or create a custom field setter that will take String[] as a parameter.
I also assume that on your page You are submiting it as an array?

Best greetings,
Paweł Wielgus.


2011/5/10 srsankar :
> i am having a array of strings on javascript and i would like to make an ajax
> call to struts 2 action which expects List. I need to know a way to
> pass these values to action which will recognize it. If i pass the array
> directly, SOP is printing it as an Object and it couldnt able to cast it to
> java List. Please help me to identify how to do this. thanks.
>
> --
> View this message in context: 
> http://struts.1045723.n5.nabble.com/javascript-array-to-Struts-2-action-tp4384471p4384471.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
>
>

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



javascript array to Struts 2 action

2011-05-10 Thread srsankar
i am having a array of strings on javascript and i would like to make an ajax
call to struts 2 action which expects List. I need to know a way to
pass these values to action which will recognize it. If i pass the array
directly, SOP is printing it as an Object and it couldnt able to cast it to
java List. Please help me to identify how to do this. thanks.

--
View this message in context: 
http://struts.1045723.n5.nabble.com/javascript-array-to-Struts-2-action-tp4384471p4384471.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: Calling an action class through Javascript -Struts 2.

2011-03-21 Thread CRANFORD, CHRIS

I would highly recommend AJAX/JSON/jQuery, they are Javascript.

Question - 

Does your requirement state that the data should be server-call back
delay delivered?
Does your requirement expect the data to be pre-rendered and the DOM
updated real-time?

Either way, I would use jQuery to perform either of the tasks.  In the
case of the first, I would have jQuery do an AJAX call back to the
server, and upon success, iterate the JSON result and update the DOM
accordingly.  In the case of the later, I'd embed the data in hidden
DIVs and then upon the change event, I'd use jQuery to iterate over my
hidden DIVs and retrieve the embedded data and then update the DOM
similarly to that of the AJAX call.

> -Original Message-
> From: JavaNoobie87 [mailto:vivek...@enzentech.com]
> Sent: Monday, March 21, 2011 12:16 AM
> To: user@struts.apache.org
> Subject: Calling an action class through Javascript -Struts 2.
> 
> Hi All ,
> I'm trying to call an action class , On change of the values in a
> dropdown
> box in my jsp .I also have to pass a value to the action class to
> execute
> the method . Im trying to implement it only using Javascript as part
of
> our
> project requirements , and so using AJAX with JSON , dwr etc is ruled
> out .
> If anyone could provide pointers of its implementation using
Javascript
> it
> would be great.
> 
> --
> View this message in context:
> http://struts.1045723.n5.nabble.com/Calling-an-action-class-through-
> Javascript-Struts-2-tp4183166p4183166.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
> 



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



Re: Calling an action class through Javascript -Struts 2.

2011-03-21 Thread Dave Newton
On Mon, Mar 21, 2011 at 9:31 AM, adam pinder wrote:
> you can use AJAX functionality straight from plain old javascript without 
> using DOJO
> or other javascript libraries - its just those libs make it easier.

Make it easier to the point of it being a Really Bad Idea to do it
*without* them.

Use one.

Dave

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



RE: Calling an action class through Javascript -Struts 2.

2011-03-21 Thread adam pinder

 
 
if you don't use AJAX then you can only do the standard get/post based on form 
submission which is a synchronous call.
 
you can use AJAX functionality straight from plain old javascript without using 
DOJO or other javascript libraries - its just those libs make it easier.
 
adam

 
> Date: Sun, 20 Mar 2011 22:16:19 -0700
> From: vivek...@enzentech.com
> To: user@struts.apache.org
> Subject: Calling an action class through Javascript -Struts 2.
> 
> Hi All ,
> I'm trying to call an action class , On change of the values in a dropdown
> box in my jsp .I also have to pass a value to the action class to execute
> the method . Im trying to implement it only using Javascript as part of our
> project requirements , and so using AJAX with JSON , dwr etc is ruled out .
> If anyone could provide pointers of its implementation using Javascript it
> would be great.
> 
> --
> View this message in context: 
> http://struts.1045723.n5.nabble.com/Calling-an-action-class-through-Javascript-Struts-2-tp4183166p4183166.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: Calling an action class through Javascript -Struts 2.

2011-03-21 Thread Dave Newton
On Mon, Mar 21, 2011 at 1:16 AM, JavaNoobie87 wrote:
> Im trying to implement it only using Javascript as part of our project
> requirements , and so using AJAX with JSON , dwr etc is ruled out.

Both Ajax and JSON are JavaScript.

Dave

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



Re: Calling an action class through Javascript -Struts 2.

2011-03-21 Thread APE SHOW
we just use js ajax request the json data from struts2 action. you can
find a jsonlib from json.org, written by java,it's quite easy... good
luck


mead.ipod

On 2011-3-21, at 13:16, JavaNoobie87  wrote:

> Hi All ,
> I'm trying to call an action class , On change of the values in a dropdown
> box in my jsp .I also have to pass a value to the action class to execute
> the method . Im trying to implement it only using Javascript as part of our
> project requirements , and so using AJAX with JSON , dwr etc is ruled out .
> If anyone could provide pointers of its implementation using Javascript it
> would be great.
>
> --
> View this message in context: 
> http://struts.1045723.n5.nabble.com/Calling-an-action-class-through-Javascript-Struts-2-tp4183166p4183166.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
>

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



Calling an action class through Javascript -Struts 2.

2011-03-20 Thread JavaNoobie87
Hi All ,
I'm trying to call an action class , On change of the values in a dropdown
box in my jsp .I also have to pass a value to the action class to execute
the method . Im trying to implement it only using Javascript as part of our
project requirements , and so using AJAX with JSON , dwr etc is ruled out .
If anyone could provide pointers of its implementation using Javascript it
would be great.

--
View this message in context: 
http://struts.1045723.n5.nabble.com/Calling-an-action-class-through-Javascript-Struts-2-tp4183166p4183166.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: Invoking Javascript function from Struts 1.3

2010-12-23 Thread Dave Newton
Right, and I said don't use a struts link tag :)

Dave
On Dec 23, 2010 5:22 AM, "Dennis Atkinson" 
wrote:
> Thanks to the repliers!
>
> Tom, your solution is perfect.  Thank you!
>
> Dave, I might have been unclear as to what I was looking for.  I wasn't
specifically looking to get the  tag working; I was just looking
for a solution, with whatever would possibly help.
>
> Dennis
>
>
>
>
>
>


Re: Invoking Javascript function from Struts 1.3

2010-12-23 Thread Dennis Atkinson
Thanks to the repliers!

Tom, your solution is perfect.  Thank you!

Dave, I might have been unclear as to what I was looking for.  I wasn't 
specifically looking to get the  tag working; I was just looking for 
a solution, with whatever would possibly help.

Dennis





  

Re: Invoking Javascript function from Struts 1.3

2010-12-22 Thread Dave Newton
On Wed, Dec 22, 2010 at 12:16 PM,  wrote:

> > Why use a struts tag to generate a non-struts link?
> And, this seems like a perfectly reasonable thing to do.


Not really. The whole point of the Struts tags is to access Struts
functionality, like action mappings. All this is is pure JavaScript. No
Struts. Accessing properties to use as parameters doesn't require the use of
a Struts link tag, because that's not what the Struts link tag is for.


> We do the same thing here and it's not complicated to do.  I don't think
> you need to mess with the  tag.  Just create the tag normally,
> the same way as you would sans Struts, and use your beans to supply the
> values.


Wth. That's precisely what I said.

Dave


RE: Invoking Javascript function from Struts 1.3

2010-12-22 Thread Thomas.Sattler
>
> Why use a struts tag to generate a non-struts link?
>
>Dave
>


Dave,

The OP wrote:

> It really, really needs to work this way.

So I am going to assume that it does.

And, this seems like a perfectly reasonable thing to do.  If a company has 
existing functionality in javascript, they want to link to it.  It is illogical 
to expect them to rewrite their javascript stuff in Struts.  Or in anything 
else, for that matter.


Dennis,

We do the same thing here and it's not complicated to do.  I don't think you 
need to mess with the  tag.  Just create the tag normally, the same 
way as you would sans Struts, and use your beans to supply the values.

The three properties are prop1, prop2, prop3.


 



', 
'', 
'')">


   


Have fun.

--Tom





-Original Message-
From: Dave Newton [mailto:davelnew...@gmail.com] 
Sent: Wednesday, December 22, 2010 10:09 AM
To: Struts Users Mailing List
Subject: Re: Invoking Javascript function from Struts 1.3

Why use a struts tag to generate a non-struts link?

Dave

On Tuesday, December 21, 2010, Dennis Atkinson
 wrote:
> Greetings all.
>
> I have a problem invoking Javascript that I can't seem to solve.  I'm hoping 
> someone here has run into the same kind of thing.
>
> When I am iterating through a List of items to display (via the 
>  tag), one cell I am trying to write has to be a link to a 
> Javascript function, with three parameters.  If I wasn't using Struts, I'd 
> write standard html, like so:
>
> 405574
>
> But if I do this in Struts, I get that exact string in the cell, which isn't 
> what I want. I need to have 405574 in the cell, and when I click on it, the 
> javascript has to be invoked with those three parameters.  It really, really 
> needs to work this
>  way.
>
> I tried experimenting with the  tag, and it *seems* like that's 
> the way to go, but I am lost with respect to the associated  
> tags.  I assume I'll need three of them (one for each parameter), but I can't 
> seem to make that work.  If I give them a name, it doesn't work, and if I 
> don't give them a name that doesn't work any better.
>
> Or maybe I'm going about this all wrong?
>
> Any assistance would be very much appreciated.
>
> Thanks in advance,
>
> Dennis
>
>
>
>

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

This message is intended for the personal and confidential use of the 
designated recipient(s) named above. If you are not the intended recipient of 
this message you are hereby notified that any review, dissemination, 
distribution or copying of this message is strictly prohibited. This 
communication is for information purposes only and should not be regarded as an 
offer to sell or as a solicitation of an offer to buy any financial product, an 
official confirmation of any transaction, or as an official statement of 
Barclays Capital Inc., its subsidiaries or affiliates. Barclays Wealth is the 
wealth management division of Barclays Bank PLC, functioning through Barclays 
Capital Inc. in the United States. Barclays Capital Inc. is a U.S. registered 
broker-dealer and is regulated by the U.S. Securities & Exchange Commission. 
Member SIPC. For more information, visit us at: www.barcap.com. 

IRS Circular 230 Disclosure: Please be advised that any discussion of U.S. tax 
matters contained within this communication (including any attachments) is not 
intended or written to be used and cannot be used for the purpose of (i) 
avoiding U.S. tax related penalties or (ii) promoting, marketing or 
recommending to another party any transaction or matter addressed herein.

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



Re: Invoking Javascript function from Struts 1.3

2010-12-22 Thread Dave Newton
Why use a struts tag to generate a non-struts link?

Dave

On Tuesday, December 21, 2010, Dennis Atkinson
 wrote:
> Greetings all.
>
> I have a problem invoking Javascript that I can't seem to solve.  I'm hoping 
> someone here has run into the same kind of thing.
>
> When I am iterating through a List of items to display (via the 
>  tag), one cell I am trying to write has to be a link to a 
> Javascript function, with three parameters.  If I wasn't using Struts, I'd 
> write standard html, like so:
>
> 405574
>
> But if I do this in Struts, I get that exact string in the cell, which isn't 
> what I want. I need to have 405574 in the cell, and when I click on it, the 
> javascript has to be invoked with those three parameters.  It really, really 
> needs to work this
>  way.
>
> I tried experimenting with the  tag, and it *seems* like that's 
> the way to go, but I am lost with respect to the associated  
> tags.  I assume I'll need three of them (one for each parameter), but I can't 
> seem to make that work.  If I give them a name, it doesn't work, and if I 
> don't give them a name that doesn't work any better.
>
> Or maybe I'm going about this all wrong?
>
> Any assistance would be very much appreciated.
>
> Thanks in advance,
>
> Dennis
>
>
>
>

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



Invoking Javascript function from Struts 1.3

2010-12-22 Thread Dennis Atkinson
Greetings all.

I have a problem invoking Javascript that I can't seem to solve.  I'm hoping 
someone here has run into the same kind of thing.
 
When I am iterating through a List of items to display (via the  
tag), one cell I am trying to write has to be a link to a Javascript function, 
with three parameters.  If I wasn't using Struts, I'd write standard html, like 
so:

405574

But if I do this in Struts, I get that exact string in the cell, which isn't 
what I want. I need to have 405574 in the cell, and when I click on it, the 
javascript has to be invoked with those three parameters.  It really, really 
needs to work this
 way.

I tried experimenting with the  tag, and it *seems* like that's the 
way to go, but I am lost with respect to the associated  tags.  I 
assume I'll need three of them (one for each parameter), but I can't seem to 
make that work.  If I give them a name, it doesn't work, and if I don't give 
them a name that doesn't work any better.

Or maybe I'm going about this all wrong?

Any assistance would be very much appreciated.

Thanks in advance,

Dennis



  

Re: execute javascript after action's html renders

2010-12-03 Thread Colin Freas
ehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
>
>
>
>
>
> > Date: Thu, 2 Dec 2010 09:05:00 +0900
> > Subject: Re: execute javascript after action's html renders
> > From: liying.cn.2...@gmail.com
> > To: user@struts.apache.org
> >
> > Do you mean calling one action, from another action page, using AJAX?
> >
> > Let's say, ActionA is the container page, some AJAX code running in
> > this page, retrieving the response of ActionB, and append the response
> > to the container page.
> >
> > Do I understand it right?
> >
> > In this case, you can embed JavaScript code, in the page code of ActionB,
> likes:
> >
> > ===
> > 
> > 
> >
> > 
> > do something here.
> > 
> > ===
> >
> > or you can use the "success" event of AJAX.
> > See: http://api.jquery.com/jQuery.ajax/
> > for more information.
> >
> > -
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
>
>


Re: execute javascript after action's html renders

2010-12-02 Thread Colin Freas
So, the "parent" action is using a Dojo *div* tag, with the
*executeScripts* attribute
set to true.

The script in the "child" action, which is referenced in the *div* tag, is
inline JavaScript.

So parent is like:




Child is:

... html/jsp fragments ...


alert("blah blah blah");





If I go to child.action from a browser, script runs.  If I got to
parent.action, script doesn't run.

-Colin

On Wed, Dec 1, 2010 at 4:22 PM, Dave Newton  wrote:

> How is the JavaScript implemented in the child action?
>
> And do you mean that an  tag is being used (from a JSP? FM?)
> to load an action (the "child" from above)?
>
> Dave
>
> On Tue, Nov 30, 2010 at 4:50 PM, Colin Freas  wrote:
>
> > On Struts 2.1.6, Dojo and JSON plugins.
> >
> > I want to execute some JavaScript after an action's HTML finishes
> loading.
> >
> > I can't figure out how to make this happen consistently.  The action that
> > I'm trying to modify is as part of another action.  When I access the
> child
> > action directly, the script runs.  When I access it through the parent
> > action, it doesn't.
> >
> > There is an attribute "executeScripts" (or similar) set, but...  as near
> as
> > I can tell, the script doesn't get run for some reason.
> >
> > So...  what's the best way to ensure that a script gets run when it's
> > loaded
> > by an action?  Where might this script be stripped or otherwise disabled
> > from running?
> >
> > Any help appreciated.
> >
> > -Colin
> >
>


Re: Calling Struts Action from JavaScript

2010-12-01 Thread Li Ying
OR,

You can send a whole HTML code of the  as response.

In this case, your server side view will be simple, just like any normal JSP.
The client side will receive the HTML code, and you can insert this
HTML piece into your page.
But it will be difficult to manipulate, because what you get is not
the raw data.


Basically,
if you want some simple html view, you can generate it on server side,
by using normal JSP.
If you want more complex flexible view, it is better to response the
raw data(in JSON), and manipulate it on the client side, by
JavaScript.

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



Re: execute javascript after action's html renders

2010-12-01 Thread Dave Newton
How is the JavaScript implemented in the child action?

And do you mean that an  tag is being used (from a JSP? FM?)
to load an action (the "child" from above)?

Dave

On Tue, Nov 30, 2010 at 4:50 PM, Colin Freas  wrote:

> On Struts 2.1.6, Dojo and JSON plugins.
>
> I want to execute some JavaScript after an action's HTML finishes loading.
>
> I can't figure out how to make this happen consistently.  The action that
> I'm trying to modify is as part of another action.  When I access the child
> action directly, the script runs.  When I access it through the parent
> action, it doesn't.
>
> There is an attribute "executeScripts" (or similar) set, but...  as near as
> I can tell, the script doesn't get run for some reason.
>
> So...  what's the best way to ensure that a script gets run when it's
> loaded
> by an action?  Where might this script be stripped or otherwise disabled
> from running?
>
> Any help appreciated.
>
> -Colin
>


execute javascript after action's html renders

2010-12-01 Thread Colin Freas
On Struts 2.1.6, Dojo and JSON plugins.

I want to execute some JavaScript after an action's HTML finishes loading.

I can't figure out how to make this happen consistently.  The action that
I'm trying to modify is as part of another action.  When I access the child
action directly, the script runs.  When I access it through the parent
action, it doesn't.

There is an attribute "executeScripts" (or similar) set, but...  as near as
I can tell, the script doesn't get run for some reason.

So...  what's the best way to ensure that a script gets run when it's loaded
by an action?  Where might this script be stripped or otherwise disabled
from running?

Any help appreciated.

-Colin


RE: Calling Struts Action from JavaScript

2010-12-01 Thread Biesbrock, Kevin
I think you should use JSON for that usecase.  Object arrayLists in JSON
are simple enough to use.

JSON:



rows = [
{id:1,name:'field1'},
{id:2,name:'field2'}
];


----


JavaScript:



var table = '';
for(var i=0,il=rows.length; i';
table += '  ' + row.id
+ '';
table += '  ' +
row.name + '';
table += '';
}
table += '';




That's how I'd do it.  Hope that helps!

Beez

-Original Message-
From: Anjib Mulepati [mailto:anji...@hotmail.com] 
Sent: Wednesday, December 01, 2010 1:56 PM
To: Struts Users Mailing List
Subject: Re: Calling Struts Action from JavaScript

Ok

JSON seems to be easy way to represent the complex result. But I am
still confuse whether I should use JSON or not?

My result are set of records from the database so it have tabular form. 
For that reason I am using Arraylist of Object and putting those result
in arraylist.

Is this a good practice?

Anjib


On 12/1/2010 10:26 AM, Biesbrock, Kevin wrote:
> Example: http://www.json.org/example.html
>
> All the information you could want and so much more:
> http://www.google.com/search?q=json
>
>
> Beez
>
> -Original Message-
> From: Anjib Mulepati [mailto:anji...@hotmail.com]
> Sent: Wednesday, December 01, 2010 10:24 AM
> To: Struts Users Mailing List
> Subject: Re: Calling Struts Action from JavaScript
>
> Can you please write me simple example of this JSON? I have never used

> this.
>
> Anjib
> On 12/1/2010 10:13 AM, Li Ying wrote:
>> 2010/12/1 Anjib Mulepati:
>>> Li
>>> When you say sending response using JSON what does that mean?
>> I mean, send a string in JSON format as response.
>>
>> If your response is simple, for example, just a "OK" or "ERROR" flag,

>> you can use plain text.
>>
>> But when you need send a complex data strut back to client side, for 
>> example, FLAG=ERROR ERROR_MESSAGE=["input data duplication", "age is 
>> out of range"] ..
>>
>> It will be hard to express in plain text format, so XML or JSON is a 
>> better choice.
>>
>> -
>> 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
>
>
>
>
> -
> 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




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



Re: Calling Struts Action from JavaScript

2010-12-01 Thread Anjib Mulepati

Ok

JSON seems to be easy way to represent the complex result. But I am 
still confuse whether I should use JSON or not?


My result are set of records from the database so it have tabular form. 
For that reason I am using Arraylist of Object and putting those result 
in arraylist.


Is this a good practice?

Anjib


On 12/1/2010 10:26 AM, Biesbrock, Kevin wrote:

Example: http://www.json.org/example.html

All the information you could want and so much more:
http://www.google.com/search?q=json


Beez

-Original Message-
From: Anjib Mulepati [mailto:anji...@hotmail.com]
Sent: Wednesday, December 01, 2010 10:24 AM
To: Struts Users Mailing List
Subject: Re: Calling Struts Action from JavaScript

Can you please write me simple example of this JSON? I have never used
this.

Anjib
On 12/1/2010 10:13 AM, Li Ying wrote:

2010/12/1 Anjib Mulepati:

Li
When you say sending response using JSON what does that mean?

I mean, send a string in JSON format as response.

If your response is simple, for example, just a "OK" or "ERROR" flag,
you can use plain text.

But when you need send a complex data strut back to client side, for
example, FLAG=ERROR ERROR_MESSAGE=["input data duplication", "age is
out of range"] ..

It will be hard to express in plain text format, so XML or JSON is a
better choice.

-
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




-
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: Calling Struts Action from JavaScript

2010-12-01 Thread Li Ying
I recommend JSON when you need exchange complex data strut between
client and server.
Because it is very friendly to JavaScript, so you can easily handle
complex data strut in your client side JavaScript code.

Sample for JSON can be find in the web site Biesbrock has told you.
The idea of JSON is very simple, and the libraries are very easy to use.
I think you can study it in short time.

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



RE: Calling Struts Action from JavaScript

2010-12-01 Thread Biesbrock, Kevin
Example: http://www.json.org/example.html

All the information you could want and so much more:
http://www.google.com/search?q=json 


Beez

-Original Message-
From: Anjib Mulepati [mailto:anji...@hotmail.com] 
Sent: Wednesday, December 01, 2010 10:24 AM
To: Struts Users Mailing List
Subject: Re: Calling Struts Action from JavaScript

Can you please write me simple example of this JSON? I have never used
this.

Anjib
On 12/1/2010 10:13 AM, Li Ying wrote:
> 2010/12/1 Anjib Mulepati:
>> Li
>> When you say sending response using JSON what does that mean?
>
> I mean, send a string in JSON format as response.
>
> If your response is simple, for example, just a "OK" or "ERROR" flag, 
> you can use plain text.
>
> But when you need send a complex data strut back to client side, for 
> example, FLAG=ERROR ERROR_MESSAGE=["input data duplication", "age is 
> out of range"] ..
>
> It will be hard to express in plain text format, so XML or JSON is a 
> better choice.
>
> -
> 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




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



Re: Calling Struts Action from JavaScript

2010-12-01 Thread Anjib Mulepati

Can you please write me simple example of this JSON? I have never used this.

Anjib
On 12/1/2010 10:13 AM, Li Ying wrote:

2010/12/1 Anjib Mulepati:

Li
When you say sending response using JSON what does that mean?


I mean, send a string in JSON format as response.

If your response is simple, for example, just a "OK" or "ERROR" flag,
you can use plain text.

But when you need send a complex data strut back to client side, for example,
FLAG=ERROR
ERROR_MESSAGE=["input data duplication", "age is out of range"]
..

It will be hard to express in plain text format, so XML or JSON is a
better choice.

-
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: Calling Struts Action from JavaScript

2010-12-01 Thread Li Ying
2010/12/1 Anjib Mulepati :
> Li
> When you say sending response using JSON what does that mean?


I mean, send a string in JSON format as response.

If your response is simple, for example, just a "OK" or "ERROR" flag,
you can use plain text.

But when you need send a complex data strut back to client side, for example,
FLAG=ERROR
ERROR_MESSAGE=["input data duplication", "age is out of range"]
..

It will be hard to express in plain text format, so XML or JSON is a
better choice.

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



Re: Calling Struts Action from JavaScript

2010-12-01 Thread Anjib Mulepati

Li
When you say sending response using JSON what does that mean?
I have been sending result between view and action class by putting in 
request object as


request.setAttribute("result",resultFrom);  and
request.getAttribute("result")

What can be better approach than this?

Thanks
Anjib


On 11/30/2010 4:21 PM, Chris Pratt wrote:

Either use ajax or submit the page request, there's no other good way to
access a server side resource from the client side.
   (*chris*)
On Nov 30, 2010 1:15 PM, "Anjib Mulepati"  wrote:

Struts 1.3.8

I have text box and button in the JSP page with the function on
onCLick() event.

Re: Calling Struts Action from JavaScript

2010-11-30 Thread Li Ying
Chris is right.

On the client side, there is not such a concept of "Struts
Action".There is Server Side Resource only.

You have to access(post or get) it by URL, param, and you must handle
the response from the server side.


Code should looks like:

(1)Client side JavaScript
Send a request to Server side. (Post or Get)

(2)Server side do the validation first.
When the param data is not good. Do nothing, and send a "FAIL
FLAG"+"ErrorMessage" as response.

(3)When the validation passed, insert data into DB,
and send a "OK FLAG" as response.

(4)Client Side JavaScript receive the response.
If it is a "FAIL", show error on the page.
If it is a "OK", append data to the table.

About the response, You can use plain text, HTML, XML, or JSON.
I recommend JSON, because it is very friendly to client side JavaScript

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



Re: Calling Struts Action from JavaScript

2010-11-30 Thread Chris Pratt
Either use ajax or submit the page request, there's no other good way to
access a server side resource from the client side.
  (*chris*)
On Nov 30, 2010 1:15 PM, "Anjib Mulepati"  wrote:
> Struts 1.3.8
>
> I have text box and button in the JSP page with the function on
> onCLick() event.
> 

Calling Struts Action from JavaScript

2010-11-30 Thread Anjib Mulepati

Struts 1.3.8

I have text box and button in the JSP page with the function on 
onCLick() event.


Re: Running external Javascript files through Struts/Freemarker -- access to ActionContext and ValueStack?

2010-11-12 Thread Li Ying
My suggestion:

(1)Reference your js file as a static resource.

(2)If the js need some dynamic information from your action.
You can put js variables or hidden tags in your jsp,
and retrieve these variables or hidden tags in your js.

The js can be static outside resource, but [dynamic information] will
be inlined in your jsp.
This is a little ugly, but i think it is very simple.

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



Re: Running external Javascript files through Struts/Freemarker -- access to ActionContext and ValueStack?

2010-11-12 Thread Dave Newton
If the request isn't hitting an action or the S2 interceptor stack and
filter there will not be a value stack... if you just request an ftl it
won't be processed by S2 at all, no?

Options include making an actual S2 request, passing in messages to the JS,
creating a global message object and referencing it from the JS, and so on.

Dave
On Nov 12, 2010 8:48 PM,  wrote:
> I have an action and freemarker result that includes an external
Javascript file. This javascript files needs to be able to use the getText()
method. I figured I'd name it "util.js.ftl" so that accessing it directly
caused the sitemesh-freemarker filter to catch it, but this throws a
NullPointerException (maybe because there's no ActionContext?):
>
> GET /myservlet/util.js.ftl
> java.lang.NullPointerException
>
org.apache.struts2.sitemesh.FreemarkerDecoratorServlet.process(FreemarkerDecoratorServlet.java:176)
>
org.apache.struts2.sitemesh.FreemarkerDecoratorServlet.doGet(FreemarkerDecoratorServlet.java:130)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter.doFilter(StrutsExecuteFilter.java:85)
>
com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
>
com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter.doFilter(StrutsPrepareFilter.java:82)
> rss.web.filter.SkinFilter.doFilter(SkinFilter.java:98)
>
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> The action is simple and just returns SUCCESS.
>
> 
> index.ftl
> 
>
> Is there a recommended way for a result template to load external files
such that they are separate GET requests from the browser, but are still
parsed through the Sitemesh-Freemarker filters and servlets, with access to
the value stack? If I simply <#include "*/util.js.ftl" /> then the content
is inlined -- this is not what I'm after.
>
> I am using Struts 2.2.1 with Sitemesh+Freemarker Decorators as described
on the sitemesh-plugin.html doc in the "Full Integration" section.
>
> Sincerely,
> Roland


Running external Javascript files through Struts/Freemarker -- access to ActionContext and ValueStack?

2010-11-12 Thread struts . rgm
I have an action and freemarker result that includes an external Javascript 
file.  This javascript files needs to be able to use the getText() method.  I 
figured I'd name it "util.js.ftl" so that accessing it directly caused the 
sitemesh-freemarker filter to catch it, but this throws a NullPointerException 
(maybe because there's no ActionContext?):

GET /myservlet/util.js.ftl
java.lang.NullPointerException

org.apache.struts2.sitemesh.FreemarkerDecoratorServlet.process(FreemarkerDecoratorServlet.java:176)

org.apache.struts2.sitemesh.FreemarkerDecoratorServlet.doGet(FreemarkerDecoratorServlet.java:130)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter.doFilter(StrutsExecuteFilter.java:85)

com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)

com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)

org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter.doFilter(StrutsPrepareFilter.java:82)
rss.web.filter.SkinFilter.doFilter(SkinFilter.java:98)

org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
The action is simple and just returns SUCCESS.


index.ftl


Is there a recommended way for a result template to load external files such 
that they are separate GET requests from the browser, but are still parsed 
through the Sitemesh-Freemarker filters and servlets, with access to the value 
stack?  If I simply <#include "*/util.js.ftl" /> then the content is inlined -- 
this is not what I'm after.

I am using Struts 2.2.1 with Sitemesh+Freemarker Decorators as described on the 
sitemesh-plugin.html doc in the "Full Integration" section.

Sincerely,
Roland

Re: referencing javascript files from (action) jsp file

2010-10-15 Thread Li Ying
Thanks a lot, I will try it.


2010/10/15 Robert Taylor :
> Hi Li,
>
> JSTL and EL give you access to the implicit pageContext object.
> From there you can access attributes from request and session.
>
>
> For example:
> 
>
> And then use contextPath variable however you wish.
>
> I'm not sure how this would translate into an OGNL expression.
> But I'm sure others on this list do :)
>
> /robert
>

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



Re: referencing javascript files from (action) jsp file

2010-10-15 Thread Robert Taylor

Hi Li,

JSTL and EL give you access to the implicit pageContext object.

From there you can access attributes from request and session.



For example:


And then use contextPath variable however you wish.

I'm not sure how this would translate into an OGNL expression.
But I'm sure others on this list do :)

/robert

- Original Message - 
From: "Li Ying" 

To: "Struts Users Mailing List" 
Sent: Friday, October 15, 2010 4:12 AM
Subject: Re: referencing javascript files from (action) jsp file



Hi Robert and Dave:

I tried  in my application, and it works for almost all the case.

But there is one exception:

In my application, i customized the CSS files shiped with Struts JQuery 
plugin


and put them under path [{contextPath}/res/struts/].

In JSP, i need add code likes:



to tell Struts JQuery plugin where to load js/css files.

In this case, i think  can not help,

because [contextPath] is a part of attribute value of another tag.

I tried "%{#request.getContextPath()}", but it don't work for some
reason i don't know.

So i decide to remain my old solution(adding a property in my Action),

so i can reference [contextPath] in Struts tags.

Of cause, in simlpe URL case,  is a better choice.

-
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: referencing javascript files from (action) jsp file

2010-10-15 Thread Dale Newfield

On 10/15/10 4:12 AM, Li Ying wrote:

I tried "%{#request.getContextPath()}", but it don't work for some
reason i don't know.


#request is not the request object, it's a map containing the items in 
request scope.


-Dale

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



Re: referencing javascript files from (action) jsp file

2010-10-15 Thread Li Ying
You can read this document:
http://struts.apache.org/2.2.1/docs/static-content.html

and check if your configuration is right.



2010/10/15 Guy Thomas :
> Thank you, this works. I would like to draw your attention to possible 
> problems with the struts head tag. See below.
>
> 
> Domain Security Administrator: Pas gebruiker aan
> " rel="stylesheet" 
> type="text/css">
> " type="text/javascript">
> " 
> type="text/javascript">
> 
>
> is converted into:
>
> 
> Domain Security Administrator: Pas gebruiker aan
>  rel="stylesheet" type="text/css">
> 
>  type="text/javascript">
> 
>
> - Struts head tag problems.
>
> However, there could be a problem when the  tag has to be included 
> for one reason or another.
>
> In that case:
>
> 
> Domain Security Administrator: Pas gebruiker aan
> " rel="stylesheet" 
> type="text/css">
> " type="text/javascript">
> " 
> type="text/javascript">
> 
> 
>
> is converted into:
>
> 
> Domain Security Administrator: Pas gebruiker aan
>  rel="stylesheet" type="text/css">
> 
>  type="text/javascript">
>  type="text/css"/>
>  type="text/javascript">
> 
>
> which causes the following errors to be shown in the chrome javascript 
> console:
>
> Failed to load resource: the server responded with a status of 404 (Not 
> Found) utils.js
> Failed to load resource: the server responded with a status of 404 (Not 
> Found) styles.css
>
> No idea what utils.js and styles.css are.
>
> When adding theme="simple" to the head tag only the utils.js error message is 
> generated.
>
>
>

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



Re: referencing javascript files from (action) jsp file

2010-10-15 Thread Li Ying
[utils.js] is used for client side validation.
it should be found in
[struts2-core-2.2.1.jar/org/apache/struts2/static/utils.js]


[styles.css] is used for Struts themes.
it should be found in [struts2-core-2.2.1.jar/template/theme_name/styles.css]




2010/10/15 Guy Thomas :
> Thank you, this works. I would like to draw your attention to possible 
> problems with the struts head tag. See below.
>
> 
> Domain Security Administrator: Pas gebruiker aan
> " rel="stylesheet" 
> type="text/css">
> " type="text/javascript">
> " 
> type="text/javascript">
> 
>
> is converted into:
>
> 
> Domain Security Administrator: Pas gebruiker aan
>  rel="stylesheet" type="text/css">
> 
>  type="text/javascript">
> 
>
> - Struts head tag problems.
>
> However, there could be a problem when the  tag has to be included 
> for one reason or another.
>
> In that case:
>
> 
> Domain Security Administrator: Pas gebruiker aan
> " rel="stylesheet" 
> type="text/css">
> " type="text/javascript">
> " 
> type="text/javascript">
> 
> 
>
> is converted into:
>
> 
> Domain Security Administrator: Pas gebruiker aan
>  rel="stylesheet" type="text/css">
> 
>  type="text/javascript">
>  type="text/css"/>
>  type="text/javascript">
> 
>
> which causes the following errors to be shown in the chrome javascript 
> console:
>
> Failed to load resource: the server responded with a status of 404 (Not 
> Found) utils.js
> Failed to load resource: the server responded with a status of 404 (Not 
> Found) styles.css
>
> No idea what utils.js and styles.css are.
>
> When adding theme="simple" to the head tag only the utils.js error message is 
> generated.
>
>

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



Re: referencing javascript files from (action) jsp file

2010-10-15 Thread Li Ying
Hi Robert and Dave:

I tried  in my application, and it works for almost all the case.

But there is one exception:

In my application, i customized the CSS files shiped with Struts JQuery plugin

and put them under path [{contextPath}/res/struts/].

In JSP, i need add code likes:



to tell Struts JQuery plugin where to load js/css files.

In this case, i think  can not help,

because [contextPath] is a part of attribute value of another tag.

I tried "%{#request.getContextPath()}", but it don't work for some
reason i don't know.

So i decide to remain my old solution(adding a property in my Action),

so i can reference [contextPath] in Struts tags.

Of cause, in simlpe URL case,  is a better choice.

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



RE: referencing javascript files from (action) jsp file

2010-10-14 Thread Guy Thomas
Thank you, this works. I would like to draw your attention to possible problems 
with the struts head tag. See below.


Domain Security Administrator: Pas gebruiker aan
" rel="stylesheet" 
type="text/css">
" type="text/javascript">
" 
type="text/javascript">


is converted into:


Domain Security Administrator: Pas gebruiker aan





- Struts head tag problems.

However, there could be a problem when the  tag has to be included for 
one reason or another.

In that case:


Domain Security Administrator: Pas gebruiker aan
" rel="stylesheet" 
type="text/css">
" type="text/javascript">
" 
type="text/javascript">



is converted into:


Domain Security Administrator: Pas gebruiker aan







which causes the following errors to be shown in the chrome javascript console:

Failed to load resource: the server responded with a status of 404 (Not Found) 
utils.js
Failed to load resource: the server responded with a status of 404 (Not Found) 
styles.css

No idea what utils.js and styles.css are.

When adding theme="simple" to the head tag only the utils.js error message is 
generated.




-Oorspronkelijk bericht-
Van: Robert Taylor [mailto:rtay...@dtgresults.com] 
Verzonden: donderdag 14 oktober 2010 16:54
Aan: Struts Users Mailing List
Onderwerp: Re: referencing javascript files from (action) jsp file

Or you could simply use JSTL.
The following works for me:
">



/robert

- Original Message - 
From: "Li Ying" 
To: "Struts Users Mailing List" 
Sent: Thursday, October 14, 2010 10:33 AM
Subject: Re: referencing javascript files from (action) jsp file


>I suggest you to reference your resource file(js, image, css and so
> on) in this way:
>
>  />/path/filename.js">
>
>
> The [] part will
> render the contextPath where the web application
> is deployed.
>
> The [contextPath] is a property defined in Action:
> public String getContextPath() {
> return ServletActionContext.getServletContext().getContextPath();
> }
>
> I put this property in the supper class of all of the Action classes
> so i can reference this property in all the pages
>
> -
> 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




-
Aan dit bericht kunnen geen rechten worden ontleend. Alle berichten naar dit 
professioneel e-mailadres kunnen door de werkgever gelezen worden.
Ondernemingsnummer: 0253.973.219



Re: referencing javascript files from (action) jsp file

2010-10-14 Thread Li Ying
Hi guys:

 looks like a better choice. I will try it in my project.

Thanks~~~

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



Re: referencing javascript files from (action) jsp file

2010-10-14 Thread Dave Newton
I'd vote for using JSTL: when standard functionality overlaps with something
you implement yourself, it's always better to opt for standard
functionality. It makes the JSP easier to understand for those unfamiliar
with custom functionality implemented at the action level.

Dave

On Thu, Oct 14, 2010 at 10:54 AM, Robert Taylor wrote:

> Or you could simply use JSTL.
> The following works for me:
> ">
>
>
>
> /robert
>
> - Original Message - From: "Li Ying" 
> To: "Struts Users Mailing List" 
> Sent: Thursday, October 14, 2010 10:33 AM
> Subject: Re: referencing javascript files from (action) jsp file
>
>
>
>  I suggest you to reference your resource file(js, image, css and so
>> on) in this way:
>>
>> > />/path/filename.js">
>>
>>
>> The [] part will
>> render the contextPath where the web application
>> is deployed.
>>
>> The [contextPath] is a property defined in Action:
>> public String getContextPath() {
>> return ServletActionContext.getServletContext().getContextPath();
>> }
>>
>> I put this property in the supper class of all of the Action classes
>> so i can reference this property in all the pages
>>
>> -
>> 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: referencing javascript files from (action) jsp file

2010-10-14 Thread Robert Taylor

Or you could simply use JSTL.
The following works for me:
">




/robert

- Original Message - 
From: "Li Ying" 

To: "Struts Users Mailing List" 
Sent: Thursday, October 14, 2010 10:33 AM
Subject: Re: referencing javascript files from (action) jsp file



I suggest you to reference your resource file(js, image, css and so
on) in this way:

/path/filename.js">


The [] part will
render the contextPath where the web application
is deployed.

The [contextPath] is a property defined in Action:
public String getContextPath() {
return ServletActionContext.getServletContext().getContextPath();
}

I put this property in the supper class of all of the Action classes
so i can reference this property in all the pages

-
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: referencing javascript files from (action) jsp file

2010-10-14 Thread Li Ying
I suggest you to reference your resource file(js, image, css and so
on) in this way:

/path/filename.js">


The [] part will
render the contextPath where the web application
is deployed.

The [contextPath] is a property defined in Action:
public String getContextPath() {
return 
ServletActionContext.getServletContext().getContextPath();
}

I put this property in the supper class of all of the Action classes
so i can reference this property in all the pages

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



  1   2   3   4   5   6   7   8   9   10   >