Search code examples
javajspstruts2elognl

How to set value to valuestack in jsp by using Ognl?


I have an action property tree, which is a tree of objects.

How to set the tree's sub node by using OGNL?

ps:

the tree node can be accessed in JSP EL in this way:

${tree_root_node.sub_node.sub_sub_node}......

but the JSP EL don't support set value.

I want this:

${tree_root_node.sub_node.sub_sub_node="some string"}

Solution

  • Use the following OGNL expression in the Struts tag of course:

    %{tree_root_node.sub_node.sub_sub_node='some string'}