You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Karthik Manimaran <mk...@gmail.com> on 2006/01/28 08:01:39 UTC

Form pre-fill issue

Hi,

Form data is not getting pre-filled on submission. Can anyone tell me the
reason?

JSP - included from def.jsp
-----
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:form action="/Control.do?body=privacysecur_set_privacy_pref"
method="post"
name="privacyPrefForm" type="PrivacyPreferencesBean">
<html:text property="strFirstName"/>
<html:submit>
submit
</html:submit>
</html:form>

PrivacyPreferencesBean.java
--------------------------------------------
*

public* *class* PrivacyPreferencesBean *extends* ActionForm {*
**private* String strFirstName;*
**public String getStrFirstName() {
return strFirstName;
}
**public void setStrFirstName(String string) {
strFirstName = string;
}
**}*

*Entries in Struts-config.xml*

  <form-bean name="privacyPrefForm" type="
com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean">
  </form-bean>

  <action path="/Control" type="com.bofa.ecomm.snf.web.global.Control"
name="privacyPrefForm" scope="request" validate="true">
   <forward name="success" path="/jsp/global/def.jsp"/>
  </action>

Thanks and regards,

Karthik.

**

**

**

Re: Form pre-fill issue

Posted by Paul Benedict <pa...@yahoo.com>.
It must be the query parameters you stuck in the action name. I never seen that before. Turn those
into html hidden fields and try again?

--- Karthik Manimaran <mk...@gmail.com> wrote:

>  The bean property however is getting printed when jsp tags are used as
> shown below. But html:text tag doesnt populate the value.
> 
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <jsp:useBean id='privacyPrefForm'
> class='com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean'
> scope='request'>
> <jsp:setProperty name="privacyPrefForm" property="*" />
> </jsp:useBean>
> <html:html>
> <html:form action="/Control.do?body=privacysecur_set_privacy_pref"
> method="post"
> name="privacyPrefForm" type="
> com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean">
> <input type="text" name="firstname" value="<jsp:getProperty name=
> "privacyPrefForm" property="strFirstName"/>"/>
> <html:text property="strFirstName"/>
> <html:submit>submit</html:submit>
> </html:form>
> </html:html>
> 
> 
> On 1/28/06, Karthik Manimaran <mk...@gmail.com> wrote:
> >
> > Hi,
> >
> > Even after giving the fully qualified class name it doesn't work.
> >
> > Thanks and regards,
> > Karthik.
> >
> >
> >  On 1/28/06, Debendra Barik <ba...@yahoo.com> wrote:
> > >
> > > Hello,
> > > its appearing that you are using the type attribute inside the
> > > <html:form> tag, its ok but you have to give fully qualified class name of
> > > the ActionForm which you are using in the form-bean section of your
> > > struts-config.xml.
> > > that is type="com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean"
> > > Note: type attribute is optional so you can omit it if you want.
> > > Try it, i think your problem will be solved. see i have changed your
> > > code.
> > > -----
> > > <%@ page language="java" %>
> > > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> > > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> > > <html:form action="/Control.do?body=privacysecur_set_privacy_pref"
> > > method="post"
> > > name="privacyPrefForm" type="
> > > com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean">
> > > <html:text property="strFirstName"/>
> > > <html:submit>
> > > submit
> > > </html:submit>
> > > </html:form>
> > >
> > > PrivacyPreferencesBean.java
> > > --------------------------------------------
> > > *
> > >
> > > public* *class* PrivacyPreferencesBean *extends* ActionForm {*
> > > **private* String strFirstName;*
> > > **public String getStrFirstName() {
> > > return strFirstName;
> > > }
> > > **public void setStrFirstName(String string) {
> > > strFirstName = string;
> > > }
> > > **}*
> > >
> > > *Entries in Struts-config.xml*
> > >
> > > <form-bean name="privacyPrefForm" type="
> > > com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean">
> > > </form-bean>
> > >
> > > <action path="/Control" type="com.bofa.ecomm.snf.web.global.Control"
> > > name="privacyPrefForm" scope="request" validate="true">
> > >   <forward name="success" path="/jsp/global/def.jsp"/>
> > > </action>
> > >
> > > Let me know you if find your solution or not.
> > > Thanks,
> > > Debendra.
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam protection around
> > > http://mail.yahoo.com
> > >
> >
> >
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Form pre-fill issue

Posted by Karthik Manimaran <mk...@gmail.com>.
 The bean property however is getting printed when jsp tags are used as
shown below. But html:text tag doesnt populate the value.

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<jsp:useBean id='privacyPrefForm'
class='com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean'
scope='request'>
<jsp:setProperty name="privacyPrefForm" property="*" />
</jsp:useBean>
<html:html>
<html:form action="/Control.do?body=privacysecur_set_privacy_pref"
method="post"
name="privacyPrefForm" type="
com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean">
<input type="text" name="firstname" value="<jsp:getProperty name=
"privacyPrefForm" property="strFirstName"/>"/>
<html:text property="strFirstName"/>
<html:submit>submit</html:submit>
</html:form>
</html:html>


On 1/28/06, Karthik Manimaran <mk...@gmail.com> wrote:
>
> Hi,
>
> Even after giving the fully qualified class name it doesn't work.
>
> Thanks and regards,
> Karthik.
>
>
>  On 1/28/06, Debendra Barik <ba...@yahoo.com> wrote:
> >
> > Hello,
> > its appearing that you are using the type attribute inside the
> > <html:form> tag, its ok but you have to give fully qualified class name of
> > the ActionForm which you are using in the form-bean section of your
> > struts-config.xml.
> > that is type="com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean"
> > Note: type attribute is optional so you can omit it if you want.
> > Try it, i think your problem will be solved. see i have changed your
> > code.
> > -----
> > <%@ page language="java" %>
> > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> > <html:form action="/Control.do?body=privacysecur_set_privacy_pref"
> > method="post"
> > name="privacyPrefForm" type="
> > com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean">
> > <html:text property="strFirstName"/>
> > <html:submit>
> > submit
> > </html:submit>
> > </html:form>
> >
> > PrivacyPreferencesBean.java
> > --------------------------------------------
> > *
> >
> > public* *class* PrivacyPreferencesBean *extends* ActionForm {*
> > **private* String strFirstName;*
> > **public String getStrFirstName() {
> > return strFirstName;
> > }
> > **public void setStrFirstName(String string) {
> > strFirstName = string;
> > }
> > **}*
> >
> > *Entries in Struts-config.xml*
> >
> > <form-bean name="privacyPrefForm" type="
> > com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean">
> > </form-bean>
> >
> > <action path="/Control" type="com.bofa.ecomm.snf.web.global.Control"
> > name="privacyPrefForm" scope="request" validate="true">
> >   <forward name="success" path="/jsp/global/def.jsp"/>
> > </action>
> >
> > Let me know you if find your solution or not.
> > Thanks,
> > Debendra.
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
>
>

Re: Form pre-fill issue

Posted by Karthik Manimaran <mk...@gmail.com>.
Hi,

Even after giving the fully qualified class name it doesn't work.

Thanks and regards,
Karthik.


On 1/28/06, Debendra Barik <ba...@yahoo.com> wrote:
>
> Hello,
> its appearing that you are using the type attribute inside the <html:form>
> tag, its ok but you have to give fully qualified class name of the
> ActionForm which you are using in the form-bean section of your
> struts-config.xml.
> that is type="com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean"
> Note: type attribute is optional so you can omit it if you want.
> Try it, i think your problem will be solved. see i have changed your code.
> -----
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <html:form action="/Control.do?body=privacysecur_set_privacy_pref"
> method="post"
> name="privacyPrefForm" type="
> com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean">
> <html:text property="strFirstName"/>
> <html:submit>
> submit
> </html:submit>
> </html:form>
>
> PrivacyPreferencesBean.java
> --------------------------------------------
> *
>
> public* *class* PrivacyPreferencesBean *extends* ActionForm {*
> **private* String strFirstName;*
> **public String getStrFirstName() {
> return strFirstName;
> }
> **public void setStrFirstName(String string) {
> strFirstName = string;
> }
> **}*
>
> *Entries in Struts-config.xml*
>
> <form-bean name="privacyPrefForm" type="
> com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean">
> </form-bean>
>
> <action path="/Control" type="com.bofa.ecomm.snf.web.global.Control"
> name="privacyPrefForm" scope="request" validate="true">
>   <forward name="success" path="/jsp/global/def.jsp"/>
> </action>
>
> Let me know you if find your solution or not.
> Thanks,
> Debendra.
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

Re: Form pre-fill issue

Posted by Debendra Barik <ba...@yahoo.com>.
Hello,
  its appearing that you are using the type attribute inside the <html:form> tag, its ok but you have to give fully qualified class name of the ActionForm which you are using in the form-bean section of your struts-config.xml.
  that is type="com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean"
  Note: type attribute is optional so you can omit it if you want.
  Try it, i think your problem will be solved. see i have changed your code.
  -----
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:form action="/Control.do?body=privacysecur_set_privacy_pref"
method="post"
name="privacyPrefForm" type="com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean">
<html:text property="strFirstName"/>
<html:submit>
submit
</html:submit>
</html:form>

PrivacyPreferencesBean.java
--------------------------------------------
*

public* *class* PrivacyPreferencesBean *extends* ActionForm {*
**private* String strFirstName;*
**public String getStrFirstName() {
return strFirstName;
}
**public void setStrFirstName(String string) {
strFirstName = string;
}
**}*

*Entries in Struts-config.xml*

  <form-bean name="privacyPrefForm" type="
com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean">
  </form-bean>

  <action path="/Control" type="com.bofa.ecomm.snf.web.global.Control"
name="privacyPrefForm" scope="request" validate="true">
   <forward name="success" path="/jsp/global/def.jsp"/>
  </action>

Let me know you if find your solution or not.
  Thanks,
  Debendra.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com