views:

205

answers:

1

Hi All,

We have a mature application running struts 1.2 and velocity and I need to covert a page from a vm to a jsp.

So I modified my struts-config to change the forward to a new JSP file and in the JSP I try to display some data assigned to the form bean but all the form properties show empty in the JSP. When I look at the form itself I see that they are different objects. So somehow the form bean I used in my Action is not the same one that the JSP sees.

Any ideas?

        <form-beans>  

        <form-bean name="scheduleDisplayForm" type="web.scheduler.ScheduleDisplayForm"/>  

    </form-beans>  

    <action-mappings>  
        <action path="/displaySchedule"  
                type="web.scheduler.ScheduleDisplayAction"  
               name="scheduleDisplayForm" scope="request" parameter="method">  

           <!--<forward name="success" path="/scheduler/scheduler.vm"/>-->  
           <forward name="success" path="/scheduler/scheduler.jsp"/>  
       </action>  
   </action-mappings>  

in my JSP I'm just trying this:

       <%@ page contentType="text/html" %>  
   <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>  
   <%@ taglib prefix="h" uri="http://java.sun.com/jsp/jstl/xml" %>  
   <%@ taglib prefix="b" uri="http://jakarta.apache.org/struts/tags-bean" %>  

   <jsp:useBean id="schedule" class="web.scheduler.ScheduleDisplayForm" scope="request"/>  

   <!-- display the object -->  
   <%=schedule%>
   <!-- shows NULL -->  
   <%=schedule.getRoomsToDisplay()%>
A: 

Thanks Vincent and dpb!

I see what it is. In Struts config I named the form scheduleDisplayForm and in the jsp I used the name "schedule". I need to keep the naming from the struts config to get the same objects.

Dan Howard