You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by serhat tanrikut <se...@yahoo.com> on 2007/02/13 21:41:47 UTC

form submission problem in struts2 (release 2.0.5) j4

Hi All,
 
 I am evaluating struts2 and have developed a sample application using j4 similar to builtin struts2-blank application.When I submit jsp form the fallowing error occured:
     ...
     ...
     SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception catched: Error setting expression 'password' with value '[Ljava.lang.String;@174a6e2'
 Feb 13, 2007 7:24:19 PM com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
 SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception catched: Error setting expression 'username' with value '[Ljava.lang.String;@9e8c34'
 
  ....
 ....
 
   I have dropped these jar to WEB-INF/lib directory
 
          * antlr-2.7.2.jar
          * backport-util-concurrent-3.0.jar
          * commons-beanutils-1.7.0.jar
          * commons-chain-1.1.jar
          * commons-logging-1.0.4.jar
          * commons-validator-1.3.0.jar
          * freemarker-2.3.8.jar
          * ognl-2.6.9.jar
          * oro-2.0.8.jar
          * retrotranslator-runtime-1.2.0.jar
          * retrotranslator-transformer-1.2.0.jar
          * struts2-api-j4-2.0.5.jar
          * struts2-core-j4-2.0.5.jar
          * xwork-j4-2.0.0.jar
 
 ======================================================         
 and my jsp is
 
 <%@ page language="java" contentType="text/html; charset=UTF-8"
     pageEncoding="UTF-8"%>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <%@ taglib prefix="s" uri="/struts-tags" %>
 <html>
     <head>
         <title>Please Login</title>
     </head>
     <body>
       <s:form action="Logon" name="login_form" > 
           <s:textfield label="%{getText('username')}" name="username"/>
           <s:password label="%{getText('password')}" name="password" />
           <s:submit />
         </s:form>        
     </body>
 </html>
 
 ======================================================
 
 and struts.xml is
 
 <package name="login" extends="struts-default">
            <action name="index" class="packagename.IndexAction">
             <result name="success">index.jsp</result>
          </action>
          <action name="Logon_*" method="{1}" class="packagename.Logon">
             <result name="success">result.jsp</result>
             <result name="input">login.jsp</result>
          </action>
     </package>
  
 =======================================================
  and Logon.java is
        
 public class Logon extends ActionSupport {
 
     
     private static final long serialVersionUID = -178540847931051617L;
     
     
     
     public static final String loggedIn = "You have  loggedin successfully ...";
     public static final String notLoggedIn = "Login failed ...";
     public static final String _userName = "admin";
     public static final String _password = "admin";
     
     
     
     public String execute() throws Exception {
         if (isInvalid(getUsername())) return INPUT;
         if (isInvalid(getPassword())) return INPUT;
         setMessage(this.login(getUsername(),getPassword()));
         return SUCCESS;
     }
 
     private boolean isInvalid(String value) {
         return (value == null || value.length() == 0);
     }
     
     private String login(String _username,String _password){
         
         if(_username.equalsIgnoreCase(Logon._userName) &&
                 _password.equalsIgnoreCase(Logon._password))
             return loggedIn;
         else
             return notLoggedIn; 
         
     }
     private String message;
     private String username;
     private String password;
 
     public void setMessage(String message){
         this.message = message;
     }
 
     public String getMessage() {
         return message;
     }
 
     private String getPassword() {
         return password;
     }
 
     private void setPassword(String password) {
         this.password = password;
     }
 
     private String getUsername() {
         return username;
     }
 
     private void setUsername(String username) {
         this.username = username;
     }
 }
 
 =================================================
 
 Is there any problem in jars or any configuration problem? If somebody has developed a sample application using struts2 j4 version ,Can he/she send me source codes
 
  regards
 
 
 
---------------------------------
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.

Re: form submission problem in struts2 (release 2.0.5) j4

Posted by serhat tanrikut <se...@yahoo.com>.
Hi Ian,
 
 I put the Logon_* in
 
 <action name="Logon_*" method="{1}" 
class="packagename.Logon">

Because First a welcome page is displayed with the link <li><a href="<s:url action="Logon_input"/>">Sign On</a></li> and then validation is passed for the first time because input method does not have any validation effect.When sign on link clicked ,login.jsp is displayed.

I have removed all the _* configurations.My recent files are


struts.xml

   <action name="Logon" class="com.telenity.csp.portal.poc.struts2.actions.Logon">
            <result name="success">result.jsp</result>
            <result name="input">login.jsp</result>
   </action>

===============

login.jsp

<s:form action="Logon" name="login_form" > 
    <s:textfield label="%{getText('username')}" name="username"/>
    <s:password label="%{getText('password')}" name="password" />
    <s:submit />
 </s:form>  

I have put a breakpoint in the execute method and correct action was executed but same problem was occured




 Ian Roughley <ia...@fdar.com> wrote: I would create a constructor in the action, and place a 
breakpoint/logging statement in there to make sure the correct action is 
beng called.  In the HTML you have:



So the action should be /Logon.action, but your configuration is:



Which would seen to imply that the action attribute in the form should 
be "Logon_login".

/Ian


serhat tanrikut wrote:
> Hi All,
>  
> I am evaluating struts2 and have developed a sample application using j4 similar to builtin struts2-blank application.When I submit jsp form the fallowing error occured:
>      ...
>      ...
> SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception catched: Error setting expression 'password' with value '[Ljava.lang.String;@174a6e2'
>  Feb 13, 2007 7:24:19 PM com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
> SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception catched: Error setting expression 'username' with value '[Ljava.lang.String;@9e8c34'
>  
>   ....
>  ....
>  
>    I have dropped these jar to WEB-INF/lib directory
>  
>           * antlr-2.7.2.jar
>           * backport-util-concurrent-3.0.jar
>           * commons-beanutils-1.7.0.jar
>           * commons-chain-1.1.jar
>           * commons-logging-1.0.4.jar
>           * commons-validator-1.3.0.jar
>           * freemarker-2.3.8.jar
>           * ognl-2.6.9.jar
>           * oro-2.0.8.jar
>           * retrotranslator-runtime-1.2.0.jar
>           * retrotranslator-transformer-1.2.0.jar
>           * struts2-api-j4-2.0.5.jar
>           * struts2-core-j4-2.0.5.jar
>           * xwork-j4-2.0.0.jar
>  
>  ======================================================         
>  and my jsp is
>  
>  <%@ page language="java" contentType="text/html; charset=UTF-8"
>      pageEncoding="UTF-8"%>
>  
>  <%@ taglib prefix="s" uri="/struts-tags" %>
>  
>      
Please Login>          
>      
>      
>         
>            
>            
>            
>                  
>      
>  
>  
>  ======================================================
>  
>  and struts.xml is
>  
>  

>             
>              index.jsp
>           
>           
>              result.jsp
>              login.jsp
>           
>      

>   
>  =======================================================
>   and Logon.java is
>         
>  public class Logon extends ActionSupport {
>  
>      
>      private static final long serialVersionUID = -178540847931051617L;
>      
>      
>      
>      public static final String loggedIn = "You have  loggedin successfully ...";
>      public static final String notLoggedIn = "Login failed ...";
>      public static final String _userName = "admin";
>      public static final String _password = "admin";
>      
>      
>      
>      public String execute() throws Exception {
>          if (isInvalid(getUsername())) return INPUT;
>          if (isInvalid(getPassword())) return INPUT;
>          setMessage(this.login(getUsername(),getPassword()));
>          return SUCCESS;
>      }
>  
>      private boolean isInvalid(String value) {
>          return (value == null || value.length() == 0);
>      }
>      
>      private String login(String _username,String _password){
>          
>          if(_username.equalsIgnoreCase(Logon._userName) &&
>                  _password.equalsIgnoreCase(Logon._password))
>              return loggedIn;
>          else
>              return notLoggedIn; 
>          
>      }
>      private String message;
>      private String username;
>      private String password;
>  
>      public void setMessage(String message){
>          this.message = message;
>      }
>  
>      public String getMessage() {
>          return message;
>      }
>  
>      private String getPassword() {
>          return password;
>      }
>  
>      private void setPassword(String password) {
>          this.password = password;
>      }
>  
>      private String getUsername() {
>          return username;
>      }
>  
>      private void setUsername(String username) {
>          this.username = username;
>      }
>  }
>  
>  =================================================
>  
> Is there any problem in jars or any configuration problem? If somebody has developed a sample application using struts2 j4 version ,Can he/she send me source codes
>  
>   regards
>  
>  
>  
> ---------------------------------
> Don't pick lemons.
> See all the new 2007 cars at Yahoo! Autos.
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




       
   
  Serhat Tanrýkut 
  
 




 
---------------------------------
Don't be flakey. Get Yahoo! Mail for Mobile and 
always stay connected to friends.

Re: form submission problem in struts2 (release 2.0.5) j4

Posted by Ian Roughley <ia...@fdar.com>.
I would create a constructor in the action, and place a 
breakpoint/logging statement in there to make sure the correct action is 
beng called.  In the HTML you have:

<s:form action="Logon" name="login_form" >

So the action should be /Logon.action, but your configuration is:

<action name="Logon_*" method="{1}" class="packagename.Logon">

Which would seen to imply that the action attribute in the form should 
be "Logon_login".

/Ian


serhat tanrikut wrote:
> Hi All,
>  
>  I am evaluating struts2 and have developed a sample application using j4 similar to builtin struts2-blank application.When I submit jsp form the fallowing error occured:
>      ...
>      ...
>      SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception catched: Error setting expression 'password' with value '[Ljava.lang.String;@174a6e2'
>  Feb 13, 2007 7:24:19 PM com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
>  SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception catched: Error setting expression 'username' with value '[Ljava.lang.String;@9e8c34'
>  
>   ....
>  ....
>  
>    I have dropped these jar to WEB-INF/lib directory
>  
>           * antlr-2.7.2.jar
>           * backport-util-concurrent-3.0.jar
>           * commons-beanutils-1.7.0.jar
>           * commons-chain-1.1.jar
>           * commons-logging-1.0.4.jar
>           * commons-validator-1.3.0.jar
>           * freemarker-2.3.8.jar
>           * ognl-2.6.9.jar
>           * oro-2.0.8.jar
>           * retrotranslator-runtime-1.2.0.jar
>           * retrotranslator-transformer-1.2.0.jar
>           * struts2-api-j4-2.0.5.jar
>           * struts2-core-j4-2.0.5.jar
>           * xwork-j4-2.0.0.jar
>  
>  ======================================================         
>  and my jsp is
>  
>  <%@ page language="java" contentType="text/html; charset=UTF-8"
>      pageEncoding="UTF-8"%>
>  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>  <%@ taglib prefix="s" uri="/struts-tags" %>
>  <html>
>      <head>
>          <title>Please Login</title>
>      </head>
>      <body>
>        <s:form action="Logon" name="login_form" > 
>            <s:textfield label="%{getText('username')}" name="username"/>
>            <s:password label="%{getText('password')}" name="password" />
>            <s:submit />
>          </s:form>        
>      </body>
>  </html>
>  
>  ======================================================
>  
>  and struts.xml is
>  
>  <package name="login" extends="struts-default">
>             <action name="index" class="packagename.IndexAction">
>              <result name="success">index.jsp</result>
>           </action>
>           <action name="Logon_*" method="{1}" class="packagename.Logon">
>              <result name="success">result.jsp</result>
>              <result name="input">login.jsp</result>
>           </action>
>      </package>
>   
>  =======================================================
>   and Logon.java is
>         
>  public class Logon extends ActionSupport {
>  
>      
>      private static final long serialVersionUID = -178540847931051617L;
>      
>      
>      
>      public static final String loggedIn = "You have  loggedin successfully ...";
>      public static final String notLoggedIn = "Login failed ...";
>      public static final String _userName = "admin";
>      public static final String _password = "admin";
>      
>      
>      
>      public String execute() throws Exception {
>          if (isInvalid(getUsername())) return INPUT;
>          if (isInvalid(getPassword())) return INPUT;
>          setMessage(this.login(getUsername(),getPassword()));
>          return SUCCESS;
>      }
>  
>      private boolean isInvalid(String value) {
>          return (value == null || value.length() == 0);
>      }
>      
>      private String login(String _username,String _password){
>          
>          if(_username.equalsIgnoreCase(Logon._userName) &&
>                  _password.equalsIgnoreCase(Logon._password))
>              return loggedIn;
>          else
>              return notLoggedIn; 
>          
>      }
>      private String message;
>      private String username;
>      private String password;
>  
>      public void setMessage(String message){
>          this.message = message;
>      }
>  
>      public String getMessage() {
>          return message;
>      }
>  
>      private String getPassword() {
>          return password;
>      }
>  
>      private void setPassword(String password) {
>          this.password = password;
>      }
>  
>      private String getUsername() {
>          return username;
>      }
>  
>      private void setUsername(String username) {
>          this.username = username;
>      }
>  }
>  
>  =================================================
>  
>  Is there any problem in jars or any configuration problem? If somebody has developed a sample application using struts2 j4 version ,Can he/she send me source codes
>  
>   regards
>  
>  
>  
> ---------------------------------
> Don't pick lemons.
> See all the new 2007 cars at Yahoo! Autos.
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org