Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

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

serhat tanrikut

2007-02-13

Replies:


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 <ian@(protected)
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;@(protected)'
> 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;@(protected)'
>
>  ....
> ....
>
>   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
>
> <%@(protected)"
>    pageEncoding="UTF-8"%>
>
> <%@(protected)" %>
>
>    
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@(protected)
For additional commands, e-mail: user-help@(protected)




   
 
Serhat Tanr?kut







---------------------------------
Don't be flakey. Get Yahoo! Mail for Mobile and
always stay connected to friends.
©2008 junlu.com - Jax Systems, LLC, U.S.A.