Re: xml validation with indexed properties.

2017-08-02 Thread Christoph Nenning
> I'm using struts and got issue with their xml validation framework. I 
have
> form with some indexed properties where element is just plain String. 
And I
> need make validation for it. I tried to use indexedListProperty for this
> case, but it doesn't work and as I read in 'Struts in Action' it works 
only
> for indexed properties with nested properties(i.e.
> indexedProperty[].nested) and it's not suits for my issue. Maybe anyone
> knows how to resolve this?


Hi,

as workaround you could fallback to use validate() method. You might 
consider to crate a jira issue:

https://issues.apache.org/jira/projects/WW


Regards,
Christoph


This Email was scanned by Sophos Anti Virus


xml validation with indexed properties.

2017-08-01 Thread Constantine Schokk
I'm using struts and got issue with their xml validation framework. I have
form with some indexed properties where element is just plain String. And I
need make validation for it. I tried to use indexedListProperty for this
case, but it doesn't work and as I read in 'Struts in Action' it works only
for indexed properties with nested properties(i.e.
indexedProperty[].nested) and it's not suits for my issue. Maybe anyone
knows how to resolve this?


Re: Validation of indexed properties

2010-02-26 Thread hugh111111

Hi Cielpa,

'Invalid property' would suggest that your form does not contain the
property searchList. It is difficult to tell without a bit of background and
seeing some code. Can you explain what you are doing and show me your
struts-config.xml file.

By the way, your form should be declared as a DynaValidatorForm. There is no
such thing as a DynaValidatorActionForm. 

For example..

form-bean name=myForm type=org.apache.struts.action.DynaValidatorForm
form-property name=searchList type=java.util.ArrayList/ 
/form-bean



Hugh




Cielpa wrote:
 
 Hey,
 
 I have a similar problem with DynaValidatorActionForm.
 It says that invalid property when i have a ArrayList in the
 form-property name=searchList type=java.util.ArrayList/ in the
 form-bean declaration.
 
 Any idea?
  Thanks and your help is appreciated.
 Silpa
 
 hugh11 wrote:
 
 I've got a problem relating to the validation of indexed properties in
 Struts 1.1
 I get the following error message when I try to access an ArrayList of
 students in my DynaValidatorForm
 
 root cause 
 
 java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
 java.util.ArrayList.RangeCheck(Unknown Source)
 java.util.ArrayList.get(Unknown Source)
 org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:298)
 
 
 
 Here is some background to the problem...
 
 In my session I have an ArrayList called studentsList of objects of type
 experiment.mybeans.Student. A Student object has getter and setter
 methods for id, year and gradeAverage.
 
 In my students.jsp I create a table by iterating through my student
 objects like this...
 
 c:forEach var=students items=${sessionScope.group.studentsList} 
   trtdhtml:text indexed=true name=students property=id//td
   tdhtml:text indexed=true name=students property=year//td
   tdhtml:text indexed=true name=students
 property=gradeAverage//td/tr
 /c:forEach
 
 As you can see the table contains empty text boxes and I would like to
 validate these have been filled in, so in struts-config.xml I create my
 dynavalidatorform as follows...
 
 form-bean name=studentsForm
 type=org.apache.struts.validator.DynaValidatorForm 
 form-property name=students type=java.util.ArrayList /
 /form-bean
 
 And in validation.xml I place my validation rules...
 
 form name=studentsForm 
field property=id indexedListProperty=students
 depends=required
  arg0 key=error.studentid.required/
 /field
field property=year indexedListProperty=students
 depends=required
  arg0 key=error.studentyear.required/
 /field
field  property=gradeAverage indexedListProperty=students
 depends=required
  arg0 key=error.studentgrade.required/
 /field
 /form
 
 Now here is where things start to go a bit pear-shaped
 
 I have read somewhere online that I need to populate the form ArrayList
 before I get to my jsp page. So I have created an action class called
 PreStudentsAction.java which takes the student ArrayList out of the
 session and assigns it to the student ArrayList in the form before
 forwarding to the students.jsp page...
 
 public class PreStudentsAction extends Action{
  
  public ActionForward execute(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response)
   throws Exception
  {
  
  DynaValidatorForm myForm = (DynaValidatorForm)form;
  Group group = (Group)request.getSession().getAttribute(group);
  ArrayListStudent students = group.getStudentsList();
  
  myForm.set(students, students);   
  return (mapping.findForward(success));
  }
 
 }
 
 
 Finally when I run my application my table is displayed but when I fill
 in the table and press submit I get the IndexOutOfBounds error. It
 appears to me that the student ArrayList in the form remains empty and
 that my Action class was unsuccessful in populating the form's ArrayList.
 
 Can anybody see what I'm doing wrong?
 
 
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Validation-of-indexed-properties-tp27493794p27720862.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: Validation of indexed properties

2010-02-26 Thread hugh111111

Sorry Cielpa, my mistake. 
Turns out there is such a thing as a DynaValidatorActionForm. Shows how much
I know.

Hugh



hugh11 wrote:
 
 Hi Cielpa,
 
 'Invalid property' would suggest that your form does not contain the
 property searchList. It is difficult to tell without a bit of background
 and seeing some code. Can you explain what you are doing and show me your
 struts-config.xml file.
 
 By the way, your form should be declared as a DynaValidatorForm. There is
 no such thing as a DynaValidatorActionForm. 
 
 For example..
 
 form-bean name=myForm
 type=org.apache.struts.action.DynaValidatorForm
 form-property name=searchList type=java.util.ArrayList/ 
 /form-bean
 
 
 
 Hugh
 
 
 
 
 Cielpa wrote:
 
 Hey,
 
 I have a similar problem with DynaValidatorActionForm.
 It says that invalid property when i have a ArrayList in the
 form-property name=searchList type=java.util.ArrayList/ in the
 form-bean declaration.
 
 Any idea?
  Thanks and your help is appreciated.
 Silpa
 
 hugh11 wrote:
 
 I've got a problem relating to the validation of indexed properties in
 Struts 1.1
 I get the following error message when I try to access an ArrayList of
 students in my DynaValidatorForm
 
 root cause 
 
 java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
 java.util.ArrayList.RangeCheck(Unknown Source)
 java.util.ArrayList.get(Unknown Source)
 org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:298)
 
 
 
 Here is some background to the problem...
 
 In my session I have an ArrayList called studentsList of objects of type
 experiment.mybeans.Student. A Student object has getter and setter
 methods for id, year and gradeAverage.
 
 In my students.jsp I create a table by iterating through my student
 objects like this...
 
 c:forEach var=students items=${sessionScope.group.studentsList} 
   trtdhtml:text indexed=true name=students property=id//td
   tdhtml:text indexed=true name=students property=year//td
   tdhtml:text indexed=true name=students
 property=gradeAverage//td/tr
 /c:forEach
 
 As you can see the table contains empty text boxes and I would like to
 validate these have been filled in, so in struts-config.xml I create my
 dynavalidatorform as follows...
 
 form-bean name=studentsForm
 type=org.apache.struts.validator.DynaValidatorForm 
 form-property name=students type=java.util.ArrayList /
 /form-bean
 
 And in validation.xml I place my validation rules...
 
 form name=studentsForm 
field property=id indexedListProperty=students
 depends=required
  arg0 key=error.studentid.required/
 /field
field property=year indexedListProperty=students
 depends=required
  arg0 key=error.studentyear.required/
 /field
field  property=gradeAverage indexedListProperty=students
 depends=required
  arg0 key=error.studentgrade.required/
 /field
 /form
 
 Now here is where things start to go a bit pear-shaped
 
 I have read somewhere online that I need to populate the form ArrayList
 before I get to my jsp page. So I have created an action class called
 PreStudentsAction.java which takes the student ArrayList out of the
 session and assigns it to the student ArrayList in the form before
 forwarding to the students.jsp page...
 
 public class PreStudentsAction extends Action{
 
 public ActionForward execute(ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response)
  throws Exception
 {
 
 DynaValidatorForm myForm = (DynaValidatorForm)form;
 Group group = (Group)request.getSession().getAttribute(group);
 ArrayListStudent students = group.getStudentsList();
 
 myForm.set(students, students);   
 return (mapping.findForward(success));
 }
 
 }
 
 
 Finally when I run my application my table is displayed but when I fill
 in the table and press submit I get the IndexOutOfBounds error. It
 appears to me that the student ArrayList in the form remains empty and
 that my Action class was unsuccessful in populating the form's
 ArrayList.
 
 Can anybody see what I'm doing wrong?
 
 
 
 
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Validation-of-indexed-properties-tp27493794p27720956.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: Validation of indexed properties

2010-02-25 Thread Cielpa

Hey,

I have a similar problem with DynaValidatorActionForm.
It says that invalid property when i have a ArrayList in the form-property
name=searchList type=java.util.ArrayList/ in the form-bean
declaration.

Any idea?
 Thanks and your help is appreciated.
Silpa

hugh11 wrote:
 
 I've got a problem relating to the validation of indexed properties in
 Struts 1.1
 I get the following error message when I try to access an ArrayList of
 students in my DynaValidatorForm
 
 root cause 
 
 java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
 java.util.ArrayList.RangeCheck(Unknown Source)
 java.util.ArrayList.get(Unknown Source)
 org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:298)
 
 
 
 Here is some background to the problem...
 
 In my session I have an ArrayList called studentsList of objects of type
 experiment.mybeans.Student. A Student object has getter and setter methods
 for id, year and gradeAverage.
 
 In my students.jsp I create a table by iterating through my student
 objects like this...
 
 c:forEach var=students items=${sessionScope.group.studentsList} 
   trtdhtml:text indexed=true name=students property=id//td
   tdhtml:text indexed=true name=students property=year//td
   tdhtml:text indexed=true name=students
 property=gradeAverage//td/tr
 /c:forEach
 
 As you can see the table contains empty text boxes and I would like to
 validate these have been filled in, so in struts-config.xml I create my
 dynavalidatorform as follows...
 
 form-bean name=studentsForm
 type=org.apache.struts.validator.DynaValidatorForm 
 form-property name=students type=java.util.ArrayList /
 /form-bean
 
 And in validation.xml I place my validation rules...
 
 form name=studentsForm 
field property=id indexedListProperty=students depends=required
  arg0 key=error.studentid.required/
 /field
field property=year indexedListProperty=students
 depends=required
  arg0 key=error.studentyear.required/
 /field
field  property=gradeAverage indexedListProperty=students
 depends=required
  arg0 key=error.studentgrade.required/
 /field
 /form
 
 Now here is where things start to go a bit pear-shaped
 
 I have read somewhere online that I need to populate the form ArrayList
 before I get to my jsp page. So I have created an action class called
 PreStudentsAction.java which takes the student ArrayList out of the
 session and assigns it to the student ArrayList in the form before
 forwarding to the students.jsp page...
 
 public class PreStudentsAction extends Action{
   
   public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
   {
   
   DynaValidatorForm myForm = (DynaValidatorForm)form;
   Group group = (Group)request.getSession().getAttribute(group);
   ArrayListStudent students = group.getStudentsList();
   
   myForm.set(students, students);   
   return (mapping.findForward(success));
   }
 
 }
 
 
 Finally when I run my application my table is displayed but when I fill in
 the table and press submit I get the IndexOutOfBounds error. It appears to
 me that the student ArrayList in the form remains empty and that my Action
 class was unsuccessful in populating the form's ArrayList.
 
 Can anybody see what I'm doing wrong?
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Validation-of-indexed-properties-tp27493794p27714507.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



Validation of indexed properties

2010-02-07 Thread hugh111111

I've got a problem relating to the validation of indexed properties in Struts
1.1
I get the following error message when I try to access an ArrayList of
students in my DynaValidatorForm

root cause 

java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
java.util.ArrayList.RangeCheck(Unknown Source)
java.util.ArrayList.get(Unknown Source)
org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:298)



Here is some background to the problem...

In my session I have an ArrayList called studentsList of objects of type
experiment.mybeans.Student. A Student object has getter and setter methods
for id, year and gradeAverage.

In my students.jsp I create a table by iterating through my student objects
like this...

c:forEach var=students items=${sessionScope.group.studentsList} 
  trtdhtml:text indexed=true name=students property=id//td
  tdhtml:text indexed=true name=students property=year//td
  tdhtml:text indexed=true name=students
property=gradeAverage//td/tr
/c:forEach

As you can see the table contains empty text boxes and I would like to
validate these have been filled in, so in struts-config.xml I create my
dynavalidatorform as follows...

form-bean name=studentsForm
type=org.apache.struts.validator.DynaValidatorForm 
form-property name=students type=java.util.ArrayList /
/form-bean

And in validation.xml I place my validation rules...

form name=studentsForm 
   field property=id indexedListProperty=students depends=required
 arg0 key=error.studentid.required/
/field
   field property=year indexedListProperty=students depends=required
 arg0 key=error.studentyear.required/
/field
   field  property=gradeAverage indexedListProperty=students
depends=required
 arg0 key=error.studentgrade.required/
/field
/form

Now here is where things start to go a bit pear-shaped

I have read somewhere online that I need to populate the form ArrayList
before I get to my jsp page. So I have created an action class called
PreStudentsAction.java which takes the student ArrayList out of the session
and assigns it to the student ArrayList in the form before forwarding to the
students.jsp page...

public class PreStudentsAction extends Action{

public ActionForward execute(ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response)
 throws Exception
{

DynaValidatorForm myForm = (DynaValidatorForm)form;
Group group = (Group)request.getSession().getAttribute(group);
ArrayListStudent students = group.getStudentsList();

myForm.set(students, students);   
return (mapping.findForward(success));
}

}


Finally when I run my application my table is displayed but when I fill in
the table and press submit I get the IndexOutOfBounds error. It appears to
me that the student ArrayList in the form remains empty and that my Action
class was unsuccessful in populating the form's ArrayList.

Can anybody see what I'm doing wrong?



-- 
View this message in context: 
http://old.nabble.com/Validation-of-indexed-properties-tp27493794p27493794.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 Validation of Indexed Properties

2004-09-11 Thread Niall Pemberton
No Struts does not do javascript validation of indexed properties.

The createDynamicJavascript() method in JavascriptValidatorTag has the
following code:

// Skip indexed fields for now until there is a good way to handle
// error messages (and the length of the list (could retrieve from
scope?))
if (field.isIndexed()
|| field.getPage() != page
|| !field.isDependency(va.getName())) {
continue;
}

If you're interested in working on a patch, that looks like the place to
start.

Niall

- Original Message - 
From: Terry Roe [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, September 11, 2004 2:58 AM
Subject: JavaScript Validation of Indexed Properties


 I guess my last post was too lengthy for anyone to read and respond to.
   Trying again...

 Does Struts JavaScript validation work with indexed properties?  If so,
 a pointer to an example would be appreciated.  If not, confirmation that
 it's not supported would be appreciated.

 TR



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JavaScript Validation of Indexed Properties

2004-09-11 Thread Terry Roe
Niall,
Thank you very much for your response.  I'd seen many people asking this 
question, but no definitive answers.  I appreciate your help, very much.

TR
Niall Pemberton wrote:
No Struts does not do javascript validation of indexed properties.
The createDynamicJavascript() method in JavascriptValidatorTag has the
following code:
// Skip indexed fields for now until there is a good way to handle
// error messages (and the length of the list (could retrieve from
scope?))
if (field.isIndexed()
|| field.getPage() != page
|| !field.isDependency(va.getName())) {
continue;
}
If you're interested in working on a patch, that looks like the place to
start.
Niall
- Original Message - 
From: Terry Roe [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, September 11, 2004 2:58 AM
Subject: JavaScript Validation of Indexed Properties


I guess my last post was too lengthy for anyone to read and respond to.
 Trying again...
Does Struts JavaScript validation work with indexed properties?  If so,
a pointer to an example would be appreciated.  If not, confirmation that
it's not supported would be appreciated.
TR


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


JavaScript Validation of Indexed Properties

2004-09-10 Thread Terry Roe
I guess my last post was too lengthy for anyone to read and respond to. 
 Trying again...

Does Struts JavaScript validation work with indexed properties?  If so, 
a pointer to an example would be appreciated.  If not, confirmation that 
it's not supported would be appreciated.

TR
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]