You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Aleksandar Matijaca <am...@gmail.com> on 2005/07/07 20:01:22 UTC

embedding forms

Hi there,

I am having a problem, trying to embed one ValidatorForm inside of another 
--- specifically this is the situation:

I have a class InstitutionForm and a class DnaForm -- I am trying to do the 
following

public class InstitutionForm extends ValidatorForm {

private DnaForm dnaForm;

private String institution_name;


public String getInstitution_name() {
return institution_name;
}

public void setInstitution_name(String institution_name) {
this.institution_name = institution_name;
}

public DnaForm getDnaForm() {
return dnaForm;
}
public void setDnaForm(DnaForm dnaForm) {
this.dnaForm = dnaForm;
}

}


public class DnaForm extends ValidatorForm {

private String first_name;

public String getFirst_name() {
return first_name;
}
public void setFirst_name(String first_name) {
this.first_name = first_name;
}

}


In my JSP, I have the following:

<html:form action="/processRequestAccess" method="POST">
<table border="1">
<tr>
<td><bean:message key="institution-name" /></td>
<td><html:text property="institution_name" /></td>
<td><bean:message key="title" /></td>
<td></td>
</tr>
<tr>
<td><bean:message key="address1" /></td>
<td></td>
<td><bean:message key="first-name" /></td>
<td><html:text property="dnaForm.first_name" /></td> <!-- DOESN'T LIKE THIS 
-->
</tr>
............
.............

</html:form>

the rendered JSP produces this:

12:25:33,653 INFO [TilesRequestProcessor] Tiles definition factory found for 
request processor ''.
12:25:36,567 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Invalid argument looking up property 
dnaForm.first_name of bean org.apache.struts.taglib.html.BEAN
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:1017)
at org.apache.struts.taglib.html.BaseFieldTag.renderInputElement(
BaseFieldTag.java:153)
at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java
:96)
at 
org.apache.jsp.WEB_002dINF.jsp.common.request_005faccess_jsp._jspx_meth_html_text_1
(org.apache.jsp.WEB_002dINF.jsp.common.request_005faccess_jsp:342)
at 
org.apache.jsp.WEB_002dINF.jsp.common.request_005faccess_jsp._jspx_meth_html_form_0
(org.apache.jsp.WEB_002dINF.jsp.common.request_005faccess_jsp:154)
at org.apache.jsp.WEB_002dINF.jsp.common.request_005faccess_jsp._jspService(
org.apache.jsp.WEB_002dINF.jsp.common.request_005faccess_jsp:81)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)


I am using JBoss 4.x

It is obvious, that the jsp rendering does not 'like' the
dnaForm.first_name--- is there a decent way of embedding these
Validatorform, one inside of
the other,
or should I just do a InstutionForm extends DnaForm instead??

Thanks, Alex.

Re: embedding forms

Posted by Aleksandar Matijaca <am...@gmail.com>.
Hubert, that is EXACTLY what was wrong -- you were 100% correct!
I guess, sometimes, it just takes 'another eye' to see things properly..

Cheers, Alex.


On 7/7/05, Aleksandar Matijaca <am...@gmail.com> wrote:
> 
> Wouldn't that give me a null-pointer exception?? I will give it a try,
> and let you kow!
> 
> Thanks for the response, Alex.
> 
> 
> On 7/7/05, Hubert Rabago <hr...@gmail.com> wrote:
> > 
> > The problem could be that getDnaForm() is returning null. See if it
> > makes a difference if getDnaForm() instantiates dnaForm before
> > returning it if it's currently null.
> > 
> > Hubert
> > 
> > 
> > On 7/7/05, Aleksandar Matijaca < amatijaca@gmail.com> wrote:
> > > Hi there,
> > >
> > > I am having a problem, trying to embed one ValidatorForm inside of 
> > another
> > > --- specifically this is the situation: 
> > >
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> > 
> > 
>

Re: embedding forms

Posted by Aleksandar Matijaca <am...@gmail.com>.
Wouldn't that give me a null-pointer exception?? I will give it a try,
and let you kow!

Thanks for the response, Alex.


On 7/7/05, Hubert Rabago <hr...@gmail.com> wrote:
> 
> The problem could be that getDnaForm() is returning null. See if it
> makes a difference if getDnaForm() instantiates dnaForm before
> returning it if it's currently null.
> 
> Hubert
> 
> 
> On 7/7/05, Aleksandar Matijaca <am...@gmail.com> wrote:
> > Hi there,
> >
> > I am having a problem, trying to embed one ValidatorForm inside of 
> another
> > --- specifically this is the situation:
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

Re: embedding forms

Posted by Hubert Rabago <hr...@gmail.com>.
The problem could be that getDnaForm() is returning null.  See if it
makes a difference if getDnaForm() instantiates dnaForm before
returning it if it's currently null.

Hubert


On 7/7/05, Aleksandar Matijaca <am...@gmail.com> wrote:
> Hi there,
> 
> I am having a problem, trying to embed one ValidatorForm inside of another
> --- specifically this is the situation:
>

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