struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maxx <>
Subject Unable to make Type Conversion work in Struts2
Date Fri, 15 Feb 2008 18:52:37 GMT

Refering to ,
I'm currently trying to make Type Conversion working on a really
simple example. And unfortunately, nothing's working. Below are the

Could someone please tell what I'm doing wrong (I suspect something
with the OGNL expressions but could not found what...)


PS: the <s:iterator> doesn't display anything, but if you move the
testList under a JavaBean (e.g. TestBean) and you change testList to
testBean.testList as OGNL value everywhere it's used (esp. for the
iterator), it displays the values in the list... BUT the textfields
still do not work, as while submitting the form, there are some
Exceptions in the log which say:
ParametersInterceptor - [setParameters]: Unexpected Exception caught
setting 'testBean.testList(0)' on 'class
com.mycompany.somepacakge.action.TestAction: Error setting expression
'testBean.testList(0)' with value '[Ljava.lang.String;@102011a'


public class TestAction {

    public String execute() {

        List<String> testList = new ArrayList<String>(2);
        testList.add("LIST 1st VALUE");
        testList.add("LIST 2nd VALUE");

        return INPUT;


    public List<String> getTestList() {
        return (List<String>) session.get("list");

    public void setTestList(List<String> list) {
        session.put(list, "list");



// test.jsp
<%@page language="java" contentType="text/html; charset=ISO-8859-1"%>
<%@taglib prefix="s" uri="/struts-tags"%>

<s:form id="testForm" action="Test" method="post">
	Direct access: = does not work
	testList(0) = <s:property value="testList(0)" />
	testList(1) = <s:property value="testList(1)" />

	Regular iterator: = does not work
<s:iterator value="testList" status="stat">
	testList(<s:property value="#stat.index"/>) = <s:property value="top"
/> // <s:textfield name="testList(%{#stat.index})" />
	<s:submit id="submitBtn" value="Submit Test" action="Test" />

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message