留言板
error is not displaying in spring mvc portlet ?
rajiv jackz,修改在12 年前。
error is not displaying in spring mvc portlet ?
Junior Member 帖子: 92 加入日期: 11-5-19 最近的帖子
Hi
i done form submission in preference page of portlet for content editor.
if there is no error then properly saved into db.
i use validator to find errors if user submit wrong input or empty. if i submit wrong input but errors are not displayed in submited page . why?
The following code i use
@ActionMapping
public void doPost(@ModelAttribute("form")ResellerInfoForm form, BindingResult result, ModelMap modelMap, ActionRequest request, ActionResponse response) throws Exception
{
validator.validate(form,request, result);
if(!result.hasErrors()){
successfullPage();
}else{
response.setRenderParameter("action", "");
}
}
How to make display validation errors.
i done form submission in preference page of portlet for content editor.
if there is no error then properly saved into db.
i use validator to find errors if user submit wrong input or empty. if i submit wrong input but errors are not displayed in submited page . why?
The following code i use
@ActionMapping
public void doPost(@ModelAttribute("form")ResellerInfoForm form, BindingResult result, ModelMap modelMap, ActionRequest request, ActionResponse response) throws Exception
{
validator.validate(form,request, result);
if(!result.hasErrors()){
successfullPage();
}else{
response.setRenderParameter("action", "");
}
}
How to make display validation errors.
Cédric Briançon,修改在12 年前。
RE: error is not displaying in spring mvc portlet ?
New Member 帖子: 17 加入日期: 10-10-28 最近的帖子
Hi,
if you use a form in your jsp page and struts, you can make your form class extends org.apache.struts.validator.ValidatorForm, instead of ActionForm.
This way you can override this method :
and return an action error if some of your fields are empty, for example.
Cheers,
Cédric
if you use a form in your jsp page and struts, you can make your form class extends org.apache.struts.validator.ValidatorForm, instead of ActionForm.
This way you can override this method :
@Override
public ActionErrors validate(ActionMapping mapping, HttpServletRequest req) {...}
and return an action error if some of your fields are empty, for example.
Cheers,
Cédric
rajiv jackz,修改在12 年前。
RE: error is not displaying in spring mvc portlet ?
Junior Member 帖子: 92 加入日期: 11-5-19 最近的帖子
hi cedric Briancon,
am using spring mvc not struts!
thanks
am using spring mvc not struts!
thanks