EDIT.JSP (Prepopulates, but form does not submit to processor action)

<html:form action="/employee/edit">

change to <html:form action="/employee/edit.do"> (Add .do)


this will send the request to <action path="/employee/edit"
because that is the way you have configured your action tag in the web.xml.
In the web.xml it says all requests matching *.do should go to your action servlet.


extract from web.xml

 <!-- Standard Action Servlet Mapping -->
 <servlet-mapping>
   <servlet-name>action</servlet-name>
   <url-pattern>*.do</url-pattern>
 </servlet-mapping>

   <servlet-name>action</servlet-name>
   <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>


From: Joe Krause <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
Subject: Prepopulating Forms
Date: Fri, 1 Aug 2003 15:32:37 -0700

I need to pre-populate an HTML form with values from a database. I have an
action that sets up the form and a different action that processes the form.
On the actual JSP page itself, if I set the action of the <html:fom> element
to the processor action (which is what I need to do), then the form is not
pre-populated with the dorm data from the actionForm. However, if I switch
the <html:form> element to point to the setup page, then it works right
(however, then it can't process the form). I know this is just some simple
configuration proplem. Can somebody please show me the right way to do this?


Here's my code and configuration:

STRUTS-CONFIG.XML

<action path="/employee/edit"
        type="com.multivision.actions.admin.employee.EditAction"
        name="EmployeeForm"
        validate="false">

        <forward name="success"
                 path="/WEB-INF/jsp/admin/employee/edit.jsp"
                 redirect="false" />
</action>

<action path="/employee/editProcess"
        type="com.multivision.actions.admin.employee.EditProcessAction"
        name="EmployeeForm"
        input="/employee/edit.do"
        scope="request">

        <forward name="success"
                 path="/employee/list.do"
                 redirect="false" />
</action>





EDIT.JSP (no prepoluate, but form submits to processor action)

<html:form action="/employee/editProcess">







Thanks!

Joe

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to