Have you looked at this?

http://struts.apache.org/2.1.6/docs/how-do-we-repopulate-controls-when-validation-fails.html



Muthu Velappan wrote:
> 
> Thanks for the reply, Chris.. 
> 
> My problem is that in there is no two separate actions for loading and
> submitting the data back from this JSP.. To be precise, while loading the
> page it will use the input() method where as while submitting it will use
> the execute() method in my Action class
> 
> Actual headache when the validator throws error, the control will not even
> come to execute() method and I believe that's correct. Hence, it throws
> the error. 
> 
> Can you please eloborate this point in ur mail.. 
> "create a small action that gives you the Map and use the <s:action> tag
> as you populate the select"
>  
> I believe this will clear my issue but right now I don't know how to
> implement this.. Since, I'm new to this Struts development, If you could
> just point me to any tutorial or sample that would be great...
> 
> Thanks
> ~Muthu
> 
> 
> musomesa wrote:
>> 
>> Looks like your JSP pulls the data from one action, which I will call A,
>> and posts to another action, EditField. 
>> When there is an error you are bounced back to the JSP (assuming 'input'
>> leads back to this JSP but 
>> now the JSP is trying to populate the select from a property called
>> fieldTypeMap on EditField instead of fieldTypeMap on A.
>>  There is probably no such property on EditField and so it gives you the
>> stacktrace.
>> 
>> Quick and dirty solution is to create such a propertyon the EditField
>> action. If you want to avoid code duplication you could
>> create a small action that gives you the Map and use the <s:action> tag
>> as you populate the select.
>> 
>> Cheers
>> Chris aka musomesa
>> 
>> 
>> 
>> 
>> -----Original Message-----
>> From: Muthu Velappan <muthu.velap...@aspiresys.com>
>> To: user@struts.apache.org
>> Sent: Fri, 13 Mar 2009 2:12 pm
>> Subject: org.apache.jasper.JasperException: tag 'select', field 'list',
>> name 'fieldTypeID'
>> 
>> 
>> 
>> 
>> Hi,
>> 
>> I have a JSP page containing data like this...
>> 
>> <s:form name="form1" theme="qxhtml">
>>     <s:bean name="java.util.HashMap" id="qTableLayout">
>>         <s:param name="tablecolspan" value="%{2}" />
>>     </s:bean>
>>     <s:textfield name="fieldName" required="true"
>> key="fieldmgmt.fieldname">
>>         <s:param name="rowstyle" value="%{'row21'}" />
>>     </s:textfield>
>>     <s:textfield name="displayName" required="true"
>> key="fieldmgmt.displayname">
>>         <s:param name="rowstyle" value="%{'row31'}" />
>>     </s:textfield>
>>     <s:select list="fieldTypeMap"
>>         name="fieldTypeID" key="fieldmgmt.fieldtype">
>>         <s:param name="rowstyle" value="%{'row31'}" />
>>     </s:select>
>>     <s:submit value="Save Changes" align="center" cssClass="buttonstyle1"
>> action="EditField">
>>         <s:param name="rowstyle" value="%{'row31'}" />
>>     </s:submit>
>> </s:form>   
>> 
>> this page works fine in first load.. However, I end up getting problem
>> when
>> there is any validation error occured fieldname or displayname fields.
>> The
>> select box values are not loaded properly in this case, It shows a big
>> stack
>> trace like the one shown below. I found that map is not loaded back in
>> this
>> Validator error loop but I don't know how to fix this.. Can any one throw
>> some light on how to clear this out...
>> 
>> SEVERE: Servlet.service() for servlet jsp threw exception
>> tag 'select', field 'list', name 'fieldTypeID': The requested list key
>> 'fieldTypeMap' could not be resolved as a
>> collection/array/map/enumeration/iterator type. Example: people or
>> people.{name} - [unknown location]
>>     at
>> org.apache.struts2.components.Component.fieldError(Component.java:230)
>>     at
>> org.apache.struts2.components.Component.findValue(Component.java:292)
>>     at
>> org.apache.struts2.components.ListUIBean.evaluateExtraParams(ListUIBean.java:80)
>>     at
>> org.apache.struts2.components.Select.evaluateExtraParams(Select.java:105)
>>     at
>> org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:858)
>>     at org.apache.struts2.components.UIBean.end(UIBean.java:509)
>>     at
>> org.apache.struts2.views.j
>> sp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
>>     ....
>>     ....
>> 2009-03-13 10:16:04,002 ERROR (CommonsLogger.java:error:28) - 
>> java.security.PrivilegedActionException:
>> org.apache.jasper.JasperException:
>> tag 'select', field 'list', name 'fieldTypeID': The requested list key
>> 'fieldTypeMap' could not be resolved as a
>> collection/array/map/enumeration/iterator type. Example: people or
>> people.{name} - [unknown location]
>>     at java.security.AccessController.doPrivileged(Native Method)
>>     at javax.security.auth.Subject.doAs(Subject.java:396)
>>     at
>> com.aspire.propel.web.membership.SecurityInterceptor.intercept(SecurityInterceptor.java:49)
>>     at
>> com.google.inject.struts2.GuiceObjectFactory$LazyLoadedInterceptor.intercept(GuiceObjectFactory.java:171)
>>     at
>> com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
>>     at
>> com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
>>     at
>> com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
>>     at
>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
>>     at
>> com.aspire.propel.transaction.TransactionActionInterceptor$1.executeTransaction(TransactionActionInterceptor.java:58)
>>     at
>> com.aspire.propel.transaction.TransactionManager.executeTransaction(TransactionManager.java:82)
>>     at
>> com.aspire.propel.transaction.TransactionActionInterceptor.intercept(TransactionActionInterceptor.java:54)
>>     at
>> com.google.inject.struts2.GuiceObjectFactory$LazyLoadedInterceptor.intercept(GuiceObjectFactory.java:171)
>>     ....
>>     ....
>>     at java.lang.Thread.run(Thread.java:619)
>> Caused by: org.apache.jasper.JasperException: tag 'select', field 'list',
>> name 'fieldTypeID': The requested list key 'fieldTypeMap' could not be
>> resolved as a collection/array/map/enumeration/iterator type. Example:
>> people or people.{name} - [unknown location]
>>     at
>> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541)
>>     a
>> t
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:435)
>>     at
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
>>     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
>>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>     ...
>>     ...
>>     ... 61 more
>> 
>> 
>> Advance Thanks for any help..
>> 
>> ~Muthu
>> -- 
>> View this message in context:
>> http://www.nabble.com/org.apache.jasper.JasperException%3A-tag-%27select%27%2C-field-%27list%27%2C-name-%27fieldTypeID%27-tp22490368p22490368.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>> 
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/org.apache.jasper.JasperException%3A-tag-%27select%27%2C-field-%27list%27%2C-name-%27fieldTypeID%27-tp22490368p22495569.html
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to