aspose file tools*
The moose likes Struts and the fly likes Validation, problem with using action path instead of form name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validation, problem with using action path instead of form name" Watch "Validation, problem with using action path instead of form name" New topic
Author

Validation, problem with using action path instead of form name

Jasna Dosen
Greenhorn

Joined: Aug 27, 2002
Posts: 5
I'm trying to configure validation.xml using
action path instead of form name (in form element) but I'm getting an error
ActionForm doesn't exist.Seems like not accepting
action path instead of form name.

struts-conf.xml
...........
<action name="templateForm" path="/AddNewTemplate" scope="session" type="com.infinica.admin.actions.SaveTemplateAction" input="/newTemplate.jsp" validate="true">
<forward name="showInserted" path="/jsp/showInsertTemplate.jsp" />
<forward name="error" path="/jsp/newTemplate.jsp">
</forward>
</action>
............


validation.xml
......
<!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN" "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">
<form-validation>

<formset>
<form name="/AddNewTemplate">
<field property="version" depends="required">
<arg0 key="label.template.version" />
</field>
</form>

</formset>
</form-validation>

What could be an possible reason for that? I tried all possible versions of dtd file.

Thank you in advance.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Does your TemplateForm extend ValidatorActionForm? If not, that's the problem.

You extend ValidatorForm if you're using the name of the form for validation, and you extend ValidatorActionForm if you're using the name of the action.


Merrill
Consultant, Sima Solutions
Jasna Dosen
Greenhorn

Joined: Aug 27, 2002
Posts: 5
Yes, of course.Here is code of my form that extends ValidatorActionForm:

public class TemplateForm extends ValidatorActionForm {

public TemplateForm() {
super();
// TODO Auto-generated constructor stub
}
private static final long serialVersionUID = 1L;
private Integer id;
private String name = "";
private Integer version;
private byte[] itd;
private FormFile xslt;
private String creationTime;
private String modificationTime;
private Integer[] listSelected;

public String getCreationTime() {
return creationTime;
}
public void setCreationTime(String creationTime) {
this.creationTime = creationTime;
}
public byte[] getItd() {
return itd;
}
public void setItd(byte[] itd) {
this.itd = itd;
}
public String getModificationTime() {
return modificationTime;
}
public void setModificationTime(String modificationTime) {
this.modificationTime = modificationTime;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public FormFile getXslt() {
return xslt;
}
public void setXslt(FormFile xslt) {
this.xslt = xslt;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getId() {
return this.id;
}
public Integer[] getListSelected() {
return listSelected;
}
public void setListSelected(Integer[] listSelected) {
this.listSelected = listSelected;
}

public ActionErrors validate(
ActionMapping mapping,
HttpServletRequest request) {

return super.validate(mapping, request);

}


}

It looks like syntax check doesn't allowed that I put action path instead of form name.

As a addition part from struts-config.xml

<form-bean name="templateForm" type="com.infinica.admin.forms.TemplateForm">
</form-bean>
Thanks,
Jasna
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Validation, problem with using action path instead of form name