Scott Purcell wrote:
Hello,
I have a login that I call and displays its initial presentation. I am using the <html:form action="login.do"> line for when I submit its values.
But I want to put in some default values into the initial presentation. So upon reading about
<html:form> it looks like I could use the following:
<html:form action="login.do" name="loginBean" type="com.ddi.dealer.bean.LoginForm">
I think the name and type attributes to html:form were deprecated at 1.1 and now no longer exist.
Because in my struts-config.xml I have the following two sections
<form-beans> <form-bean name="loginBean" type="com.ddi.dealer.bean.LoginForm" /> </form-beans>
<action path="/login" input="/jsp/login.jsp" type="com.ddi.dealer.action.LoginAction" name="loginBean" scope="request" validate="true"> <forward name="Success" path="/jsp/welcome.jsp" /> <forward name="Failure" path="/jsp/login.jsp" /> </action>
So I was hoping that that form line would call, create new loginBean and show the data in my initial feed.
I'm not sure I know exactly what you are trying to do. But it sounds like you are trying to do what I would do in a standard setup Action/form processing Action pairing. I would have an Action that switches on the action mapping's "parameter" attribute. Two action mappings, same Action. One mapping would have parameter="viewLogin", the other parameter="doLogin". Both would name the form bean to instantiate/use, but the view mapping has validation turned off while the do mapping has validation turned on. Struts has various dispatch-type Actions that do this stuff more automatically but switching on a parameter works for me.
In the Action, if I'm processing "viewLogin", and I want default values, I invoke a populateForm method, passing 1) the form 2) a value object (presumably obtained from the model) used to set initial values.
Hope that helps.
Erik
The submitting is good, It was just something I am not understanding.
Anyone know why that does not work?
Thanks, Scott
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]