Re: Map-backed forms in Struts2

2007-04-17 Thread James Navin
Ok. I read the OGNL spec and it looks like the way of using maps etc. is
subtley different from Struts1. My JSP now looks like



and the associated Action class has methods

public void setAttribute(String key, Object value)
public Object getAttribute(String key)

The setAttribute method is still not being called (again, I have checked
with debug print statements), but this time in the catalina log I get the
following excepion messages along with a large stack trace

--snip--
Apr 18, 2007 9:57:01 AM
com.opensymphony.xwork2.util.InstantiatingNullHandler nullPropertyValue
SEVERE: Could not create and/or set value back on to object
ognl.NoSuchPropertyException:
com.csc.event.delivery.controller.EventOverviewController.attribute
[java.lang.IllegalAccessException: Class ognl.OgnlRuntime can not access a
member of class com.csc.event.delivery.controller.EventOverviewController
with modifiers "private"]
--snip--

It looks like it wants the actual attribute member to be public, but I
really dont want to do that...

Any help is much appreciated,

James

Lance <[EMAIL PROTECTED]> wrote on 17/04/2007 06:54:37 PM:

> Do you have a getValue(String key) method?
> I am not a s2 user but I have read the OGNL spec so sorry if I'm wrong
> but OGNL needs
>public PropertyType getPropertyName(IndexType index)
>and public void setPropertyName(IndexType index, PropertyType value)
>
> http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/indexing.
> html#N10189
>
> James Navin wrote:
> > Hi all,
> >
> > A system I am developing requires forms to be generated dynamically at
> > runtime based on data stored in a database. I have read that it is
possible
> > to use map-backed forms in Struts1 to achieve this using something of
the
> > form '' where the
> > associated Action class has a method of the form 'public void
> > setValue(String key, Object value)', resulting in name-value pairs
being
> > submitted to the Action class.
> >
> > Is this possible to achieve in Struts2? I have not been able to make it
> > work. When I use the above expression for the name attribute the
setValue
> > method is never called (I have checked this with a few debug print
> > statements), but no exception is thrown either. It just appears that
> > nothing happens.
> >
> > Is this something I am doing wrong, or is there some other way to do
this
> > in Struts2, or is it a bug?
> >
> > I am using Struts 2.0.6 with Java 1.5.3, Tomcat 5.5 and Internet
Explorer
> > 6.
> >
> > Thanks a lot in advance,
> >
> > James
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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



Re: Map-backed forms in Struts2

2007-04-17 Thread Lance

Do you have a getValue(String key) method?
I am not a s2 user but I have read the OGNL spec so sorry if I'm wrong 
but OGNL needs

  public PropertyType getPropertyName(IndexType index)
  and public void setPropertyName(IndexType index, PropertyType value)

http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/indexing.html#N10189

James Navin wrote:

Hi all,

A system I am developing requires forms to be generated dynamically at
runtime based on data stored in a database. I have read that it is possible
to use map-backed forms in Struts1 to achieve this using something of the
form '' where the
associated Action class has a method of the form 'public void
setValue(String key, Object value)', resulting in name-value pairs being
submitted to the Action class.

Is this possible to achieve in Struts2? I have not been able to make it
work. When I use the above expression for the name attribute the setValue
method is never called (I have checked this with a few debug print
statements), but no exception is thrown either. It just appears that
nothing happens.

Is this something I am doing wrong, or is there some other way to do this
in Struts2, or is it a bug?

I am using Struts 2.0.6 with Java 1.5.3, Tomcat 5.5 and Internet Explorer
6.

Thanks a lot in advance,

James


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

  



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



Map-backed forms in Struts2

2007-04-16 Thread James Navin

Hi all,

A system I am developing requires forms to be generated dynamically at
runtime based on data stored in a database. I have read that it is possible
to use map-backed forms in Struts1 to achieve this using something of the
form '' where the
associated Action class has a method of the form 'public void
setValue(String key, Object value)', resulting in name-value pairs being
submitted to the Action class.

Is this possible to achieve in Struts2? I have not been able to make it
work. When I use the above expression for the name attribute the setValue
method is never called (I have checked this with a few debug print
statements), but no exception is thrown either. It just appears that
nothing happens.

Is this something I am doing wrong, or is there some other way to do this
in Struts2, or is it a bug?

I am using Struts 2.0.6 with Java 1.5.3, Tomcat 5.5 and Internet Explorer
6.

Thanks a lot in advance,

James


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