[jboss-user] [JBoss Portal] - Struts 2 protlet plugin. Validation errors.

Timmmm do-not-reply at jboss.com
Tue Oct 28 10:44:31 EDT 2008


Hi.
I have some errors while validating my form.

struts.xml
    <package name="view" extends="struts-portlet-default" namespace="/view">
  |  
  |         <action name="AddClientRequestAction_*" method="{1}" class="autopay.portlet.action.AddClientRequestAction">
  |             <result name="input">/WEB-INF/jsp/view/addRequest.jsp</result>
  |             <result name="source">/WEB-INF/jsp/view/addRequest.jsp</result>
  |             <result>/WEB-INF/jsp/view/ok.jsp</result>
  |         </action>
  |     </package>
  | 
AddClientRequestAction

public class AddClientRequestAction extends ActionSupport {
  |     private String a = "aaaaaaaaaaaaa";
  |  
  |     @Override
  |     public String execute() throws Exception {
  |         System.out.println("a: " + a);
  |  
  |  
  |         if (isInvalid(a)) return INPUT;
  |         addActionMessage("my action message");
  |         return SUCCESS;
  |     }
  |  
  |     public String getA() {
  |         return a;
  |     }
  |  
  |     public void setA(String a) {
  |         this.a = a;
  |     }
  |  
  |     public void validate() {
  |         System.out.println("AddClientRequestAction - VALIDATE!!!");
  |         super.validate();
  |     }
  |  
  |     private boolean isInvalid(String value) {
  |         return (value == null || value.length() == 0);
  |     }
  | }
  | 
Exception

2008-10-27 18:56:52,452 ERROR [org.jboss.portal.core.model.portal.control.page.DefaultPageControlPolicy] Rendering portlet window produced an error
javax.portlet.PortletException: Error executing action renderDirect....

Caused by: javax.portlet.PortletException: org.apache.jasper.JasperException: java.lang.NullPointerException
at org.jboss.portal.portlet.impl.jsr168.api.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:91)
...
interesting part

Caused by: java.lang.NullPointerException
at java.text.MessageFormat.applyPattern(MessageFormat.java:422)
at java.text.MessageFormat.(MessageFormat.java:350)
at com.opensymphony.xwork2.DefaultTextProvider.getText(DefaultTextProvider.java:70)
at com.opensymphony.xwork2.DefaultTextProvider.getText(DefaultTextProvider.java:111)
at org.apache.struts2.util.TextProviderHelper.getText(TextProviderHelper.java:62)
at org.apache.struts2.util.TextProviderHelper.getText(TextProviderHelper.java:105)
at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:631)
at org.apache.struts2.components.UIBean.end(UIBean.java:509)
at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
at org.apache.jsp.WEB_002dINF.jsp.view.addRequest_jsp._jspx_meth_s_005ftextfield_005f0(addRequest_jsp.java:200)
at org.apache.jsp.WEB_002dINF.jsp.view.addRequest_jsp._jspx_meth_s_005fform_005f0(addRequest_jsp.java:132)
at org.apache.jsp.WEB_002dINF.jsp.view.addRequest_jsp._jspService(addRequest_jsp.java:73)

Extract from line 422 of MessageFormat.java as it is in Java 1.6.0_07:

for (int i = 0; i < pattern.length(); ++i) {

It seems that, struts 2 validator can't find message patterns. But i tried a great numbers of message mapping, and with out localized messages only addErrorMessage("error") method.

Could anyone help me with this error?
Thanks.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4185113#4185113

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4185113



More information about the jboss-user mailing list