struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denis Avdic <denis.av...@gmail.com>
Subject Re: Input with name different than bean name property
Date Fri, 09 Jul 2004 16:18:42 GMT
There is a value attribute in the <html:hidden> tag

>From what I understand you have a form bean that has id and parentId
as properties.

You have a child object with an id property, and you have a parent
object with an id property.

So you could have 
<html-el:hidden property="id" value="${CHILD_OBJECT.id}" />
and
<html-el:hidden property="parentId" value="${PARENT_OBJECT.id}" />


That is, you can do this if you use JSTL.  You can do the same without
-el tags and with code snippets but I just don't even want to think
about those.

Denis

On Fri, 09 Jul 2004 12:06:36 -0400, FlyingElvi <flyingelvi@punkass.com> wrote:
> Hi !
> 
> I wanted to know if there was any direct way to use a input field
> getting the value from a request bean that has a different property name
> than the form bean.
> 
> for example : Form Bean has 2 property id and parentId
> 
> in my JSP page request I have 2 objects of the same type and I want to
> populate the input field with the Id of both objects.
> 
> <html:hidden property="id" name="CHILD_OBJECT" /> // this works because
> my CHILD OBJECT has a method getId()
> <html:hidden property="parentId" name="PARENT_OBJECT" /> // this doesn't
> work because I need to call getId()
>                                                         // and not
> getParentId().
> 
> So is there any way to get it directly without having to do something
> like this ?
> <bean:define id="parentId" name="PARENT_OBJECT" property="id"/>
> <html:hidden property="parentId" value="<%=parentId + ""%>" />
> 
> Thanks
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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


Mime
View raw message