Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can I validate my form using Struts-Portlet framework functionality

 
Saurabh Joshi
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have few questions, I am using Liferay Portal for development

Question: Where is MessageResource.propertiesfile for entering keys/values which is to be displayed after form validation fails

Desc: I want to do form validation using struts validate() method. For this i need few things like

1) validate() method
2) entry of this in struts-congif.xml as validate=true
3) and most important the MessageResource.properties.

But i am using StrutsPortlet.
So do we have all this functionalities in StrutsPortlet framework?
or is there any other method other than validate() and any other file other than MessageResource.properties to handle form validation?

And if we cannot use validate(), so how to handle form validation using Struts-Portlet framework?

Thanks,
Saurabh.
[ December 21, 2007: Message edited by: Saurabh Joshi ]
 
Chinmay J. Shah
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The struts validation works fine with struts portlet.
It can be done in same way as a simple struts application.
Incase if struts validator is not invoking itself, invoke it in execute method using following piece of code

ActionErrors errors = form.validate( mapping, (ServletRequest) request );
if ( errors != null && !errors.isEmpty() ) {
saveErrors((HttpServletRequest) request, errors);
return (mapping.findForward("credit"));
}


Regards,
Chinmay
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic