Announcement Announcement Module
Collapse
No announcement yet.
Struts and webflow confusion Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Struts and webflow confusion

    Hi, this is my first app trying to incorporate webflows and im trying to keep it familiar to myself by using struts as well since Ive used it before. I think my concept on how these two work together is messed up though, for instance I have this

    Code:
    <!-- Call controller to attempt to retreive student information -->
    	<action-state id="validateStudentLogin">
    		<action bean="loginAction"/>
    		<transition on="success" to="displayLogin" />
    		<transition on="error" to="enterLogin" />
    	</action-state>
    My loginAction bean looks like this
    Code:
    <!-- Controller class definitions -->
    	<bean id="loginAction" class="edu.ucr.c3.rsvp.controller.students.Login"/>
    and then my controller class looks like this
    Code:
    public class Login extends RSVPAction  {
    	
    	public ActionForward executeRSVPApp(ActionMapping mapping, ActionForm form,
    			HttpServletRequest req,	HttpServletResponse resp, HttpSession sess) throws Exception {
    				
    		ActionForward forward = null;
    	
                    ....some database logic, etc....
    
    		return forward;
    	}//executeFRSApp
    }
    My RSVPAction looks like this
    Code:
    public abstract class RSVPAction extends FlowAction {
    	
    	public RSVPAction() {
    		super();
    	}
    	
    	/**
    	 * Do a security check and only call the executeFRSApp method if
    	 * it passes.
    	 */
    	public final ActionForward execute(ActionMapping mapping, ActionForm form,
    			HttpServletRequest req, HttpServletResponse resp) throws Exception {
    		
    		.....some code.....
    		return forward;
    	}//execute
    }
    whenever I get to the point to execute that action I throw an exception
    Code:
    org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'loginAction' must be of type [org.springframework.webflow.execution.Action], but was actually of type [edu.ucr.c3.rsvp.controller.students.Login]
    im not sure where Im going wrong because the Login class is FlowAction type. its frustrating that something that seems so simple just wont work lol. can anyone please tell me where im going wrong at so I can get this working?
    Thanks
    -Ray

  • #2
    It seems you are confusing a Struts action with an SWF action. FlowAction is SWF's integration point for Struts that is meant to launch or resume a flow. It is a Struts action and is to be configured in your struts-config. The action specified in your action-state on the other hand is an SWF action, and as you currently have it defined it must be an implementation of org.springframework.webflow.execution.Action as the error message states. There are of course other ways to implement an SWF action that do not require this interface...see the documentation for details.

    Speaking of documentation, have you looked at the excellent Practical Examples section? There is a great guided walkthrough of the Struts+SWF sample application (along with all of the other sample apps) included there:
    http://static.springframework.org/sp...rthdate-sample
    Check it out, as I think it may go a long way in making things clearer.

    -Jeremy

    Comment


    • #3
      Yea I think I do have it mixed up. I have seen that example but it seems like what im trying to do isn't really covered in that example. Im probably going to drop struts for now and just keep it simple doing pure webflows. then once I have it working ill try and see how I can change things around to integrate struts. baby steps...get a simple app working first...then try and get fancy

      Comment

      Working...
      X