I tested it just now and I do NOT get the error when I refactor the code from the POJO on down to the JSP to use "myId" instead of "id".
On Mon, May 2, 2011 at 8:43 PM, Dave Newton <davelnew...@gmail.com> wrote: > Just out of curiosity, does it do the same thing if it's not named "id"? > > d. > > On Mon, May 2, 2011 at 8:32 PM, Justin Robbins <justinhrobb...@gmail.com> > wrote: >> Anyone have any ideas on this one? I'd be most grateful for some advice. >> >> Someone suggested I use a newer version of the ognl jar. I was using >> "ognl-3.0.jar" which is what came with the Struts 2.2.1.1 >> distribution. I've since replaced it with "ognl-3.0.1.jar" but I'm >> still receiving the same error. >> >> Any help is greatly appreciated. >> >> On Mon, May 2, 2011 at 11:26 AM, Justin Robbins >> <justinhrobb...@gmail.com> wrote: >>> Hi folks, >>> >>> I have a working Action and JSP form that I'm using for creating new >>> entities in my very basic Struts 2.2.1.1 app. I'm trying to modify >>> the app to re-use the JSP form with editing of entities. I added a >>> hidden "ID" tag and now I'm getting errors when I submit the form. >>> Can someone please give me some assistance? I've Googled this issue >>> and seen others posting similar errors but I'm not sure how to resolve >>> it. >>> >>> Excerpt from Stack Trace when I submit the form: >>> 2011-05-02 11:09:36,132 3198497 ["http-bio-8080"-exec-23] WARN >>> com.opensymphony.xwork2.ognl.OgnlValueStack - Error setting expression >>> 'id' with value '[Ljava.lang.String;@100ac03' >>> ognl.MethodFailedException: Method "setId" failed for object >>> org.robbins.flashcards.model.Tag@1b9eb34 [name='null' ] >>> [java.lang.NoSuchMethodException: >>> org.robbins.flashcards.model.Tag.setId([Ljava.lang.String;)] >>> at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1285) >>> at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1474) >>> >>> Excerpt from JSP: >>> <%@ taglib prefix="s" uri="/struts-tags"%> >>> ... >>> <s:form action="saveOrUpdateTag" method="post"> >>> <s:hidden name="id" /> >>> <s:textfield name="name" key="label.tag.name" size="20" /> >>> <s:submit label="label.flashcard.submit" align="center" /> >>> </s:form> >>> >>> Excerpt from Action Class: >>> public class TagAction extends FlashCardsAppBaseAction implements >>> ModelDriven<Tag> { >>> >>> Tag tag = new Tag(); >>> >>> public Tag getTag() { >>> return tag; >>> } >>> >>> public void setTag(Tag tag) { >>> this.tag = tag; >>> } >>> public String createTag() { >>> ... >>> } >>> } >>> >>> Excerpt from POJO: >>> public class Tag implements java.io.Serializable { >>> >>> >>> private int id; >>> private String name; >>> >>> public int getId() { >>> return this.id; >>> } >>> >>> public void setId(int id) { >>> this.id = id; >>> } >>> ... >>> } >>> >>> Excerpt from Struts.xml >>> <action name="saveOrUpdateTag" >>> class="org.robbins.flashcards.presentation.TagAction" >>> method="createTag"> >>> <result name="success" type="tiles">displaytag.tiles</result> >>> <result name="input" type="tiles">tagform.tiles</result> >>> </action> >>> >>> -- >>> Regards, >>> Justin >>> >> >> >> >> -- >> Regards, >> Justin Robbins >> 973.479.0448 >> justinhrobb...@gmail.com >> >> Learn more about me by viewing my professional profile on LinkedIn >> http://www.linkedin.com/in/justinhrobbins >> >> View my professional blog >> http://javadeveloperjournal.blogspot.com/ >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- Regards, Justin Robbins 973.479.0448 justinhrobb...@gmail.com Learn more about me by viewing my professional profile on LinkedIn http://www.linkedin.com/in/justinhrobbins View my professional blog http://javadeveloperjournal.blogspot.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org