java - Set value into variable in struts1 -


i can iterate list in struts1 using below code :

<logic:iterate name="listmsg" id="listmsgid"> <p>     list messages <bean:write name="listmsgid"/> </p> </logic:iterate> 

but how can set variable within tag.

for example want fetch data above tag , initialize in variable.

<logic:iterate name="listmsg" id="listmsgid"> <p>     <%         string firstname = "get data list";      %>     list messages <bean:write name="listmsgid"/> </p> </logic:iterate> 

how can achieve above 1 using struts1 , java.

is possible? if yes how?

one solution, , imo better one, use jsp jstl. see example below:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%--@elvariable id="messages" type="java.util.list"--%>  <c:foreach items="${messages.msglist}" var="message" varstatus="st">     <c:set var="varname" value="varvalue"/>     <p>${message.id}</p>     <p>${varname}</p> <!-- print --> </c:foreach> 

hope helps!


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -