struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Extending ActionMapping in Struts 1.1 - classcast exception.
Date Wed, 06 Nov 2002 02:45:49 GMT
I am working on an app with Tomcat 4.1 and Struts 1.1. I would like  to 
extend an ActionMapping, in order to verify that the user is logged in. I 
extend an ActionMapping, create the getter and setter methods for the 
property that I have added. 

Finally, I change my web.xml and my struts-config.xml files as indicated 
below. However, in my execute ( ...) method, when I cast the ActionMapping 
parameter to a UsersActionMapping, I get a ClassCastException. It seems 
that for some reason it is disregarding the fact that I want it to pass an 
UserActionMapping object , and instead passes me a regular ActionMapping 
object. If comment out the cast to UsersActionMapping, the execute method 
executes successfully.. 

So, my question is.. what am I missing.. what else do I have to do in 
order to get an instance of an UserActionMapping object in my execute 
method, instead of getting the normal ActionMapping object... ? 

Thanks in advance... 

----  web.xml excerpt ---


-------- struts-config.xml excerpt - - - - 
<action path="/ClaimList"
            <set-property property="loginRequired" value="true" />
            <forward name="success" path="/claimslist.jsp" />

----------- excerpt ... 

public ActionForward execute(ActionMapping mapping, 
        ActionForm form, 
        HttpServletRequest request, 
        HttpServletResponse response)
        throws IOException, ServletException {

        String target = "success";
         UsersActionMapping uam = (UsersActionMapping)mapping; 



Alex Kotchnev
Diversified Information Technologies

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message