You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by carmi_cd <ca...@yahoo.com> on 2008/01/14 09:10:37 UTC

[S2]method not called

hi i have a table that has a checkbox, details of the record such as
lastname, firstname with it.
when user selects a record or records using checkbox corresponding to it,
and click the delete button
the record or records selected should be deleted. My problem is it is not
able to execute the
delete method within the action class.. It is directed to the entryform.jsp
which is an input form
when it should goes back to the list of records after it deleted the
records.

here is part of my struts.xml

        <action name="UserMgt" class="eis.module.UserMgt" method="list">
            <result name="success">/apps/modules/UserMgt/List.jsp</result>            
            <interceptor-ref name="basicStack"/>
        </action>
        <action name="UserMgt_*" class="eis.module.UserMgt" method="{1}">
            <result name="success" type="redirect-action">UserMgt</result>
            <result
name="input">/apps/modules/UserMgt/EntryForm.jsp</result>
            <result name="error">/apps/modules/UserMgt/Error.jsp</result>
        </action>                 

here is part of my UserMgt code

public class UserMgt extends eisSupport implements Preparable {
..variable declaration here..

    public String list() {
        UserBean userBean = new UserBean(); 
        setUsersList(userBean.getUsersList());
        return SUCCESS;
    }
    
    public String delete() {    
        UserBean userBean = new UserBean(); 
        if(userBean.deleteUser(getUserids())){        
            return SUCCESS;
        } 
        return ERROR;
    }
    
    public String input() {
        return INPUT;
    }    
    
}

here is part of my list.jsp

delete button that calls the submit the form
                                <s:url id="deleteActionLink"
value="UserMgt_delete.action" />
                                <s:submit name="btnDelete" 
                                          id="btnDelete" 
                                          theme="ajax" 
                                          value="Delete"
                                          cssClass="button"
                                          formId="adminForm"
                                          targets="module"
                                          loadingText="Loading..."
                                          errorText="Unable to load user
list."
                                          href="%{deleteActionLink}"                                      
                                />

here is the  checkbox

<s:checkbox theme="simple" name="userid" fieldValue="%{getUserId()}"/>         

i only included here parts of the code which i think is related to my
question.
i also get this ParametersInterceptor - [setParameters]
exception when i checked the log of my SunApp Server
Unexpected Exception catched: Error setting expression '__checkbox_userid'
with value '[Ljava.lang.String;@1839ff8'

Unexpected Exception catched: Error setting expression 'dojo.preventCache'
with value '[Ljava.lang.String;@7b88e6'


Please help me..thanks in advance.









-- 
View this message in context: http://www.nabble.com/-S2-method-not-called-tp14796735p14796735.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: [S2]method not called

Posted by Laurie Harper <la...@holoweb.net>.
carmi_cd wrote:
> hi i have a table that has a checkbox, details of the record such as
> lastname, firstname with it.
> when user selects a record or records using checkbox corresponding to it,
> and click the delete button
> the record or records selected should be deleted. My problem is it is not
> able to execute the
> delete method within the action class.. It is directed to the entryform.jsp
> which is an input form
> when it should goes back to the list of records after it deleted the
> records.

Since your submit button points to UserMgt_delete.action, it should call 
the delete() method of your action, not execute(). Do you mean that 
delete() is not called? Or that the the list() method is not called 
following the redirect if delete() returns SUCCESS?

> here is part of my struts.xml
> 
>         <action name="UserMgt" class="eis.module.UserMgt" method="list">
>             <result name="success">/apps/modules/UserMgt/List.jsp</result>            
>             <interceptor-ref name="basicStack"/>
>         </action>
>         <action name="UserMgt_*" class="eis.module.UserMgt" method="{1}">
>             <result name="success" type="redirect-action">UserMgt</result>
>             <result
> name="input">/apps/modules/UserMgt/EntryForm.jsp</result>
>             <result name="error">/apps/modules/UserMgt/Error.jsp</result>
>         </action>                 

There's nothing there that points to an entryform.jsp, so I can't think 
how that could be getting rendered...

> here is part of my UserMgt code
> 
> public class UserMgt extends eisSupport implements Preparable {
> ...variable declaration here..
> 
>     public String list() {
>         UserBean userBean = new UserBean(); 
>         setUsersList(userBean.getUsersList());
>         return SUCCESS;
>     }
>     
>     public String delete() {    
>         UserBean userBean = new UserBean(); 
>         if(userBean.deleteUser(getUserids())){        
>             return SUCCESS;
>         } 
>         return ERROR;
>     }
>     
>     public String input() {
>         return INPUT;
>     }    
>     
> }

Looks fine...

> here is part of my list.jsp
> 
> delete button that calls the submit the form
>                                 <s:url id="deleteActionLink"
> value="UserMgt_delete.action" />
>                                 <s:submit name="btnDelete" 
>                                           id="btnDelete" 
>                                           theme="ajax" 
>                                           value="Delete"
>                                           cssClass="button"
>                                           formId="adminForm"
>                                           targets="module"
>                                           loadingText="Loading..."
>                                           errorText="Unable to load user
> list."
>                                           href="%{deleteActionLink}"                                      
>                                 />
> 
> here is the  checkbox
> 
> <s:checkbox theme="simple" name="userid" fieldValue="%{getUserId()}"/>         

Did you check the resulting HTML page? Is the value for the checkbox 
what it should be? It's possible you're getting a conversion or 
validation failure. Make sure you display any available error messages 
on your input JSP and/or check the log files.

> i only included here parts of the code which i think is related to my
> question.
> i also get this ParametersInterceptor - [setParameters]
> exception when i checked the log of my SunApp Server
> Unexpected Exception catched: Error setting expression '__checkbox_userid'
> with value '[Ljava.lang.String;@1839ff8'
> 
> Unexpected Exception catched: Error setting expression 'dojo.preventCache'
> with value '[Ljava.lang.String;@7b88e6'

Aren't those logged as WARN? (as opposed to ERROR); I believe they will 
go away if you set devMode to false in struts.xml or struts.properties.

L.


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