Manish Pandit <pandit.man...@gmail.com> wrote:
On Aug 30, 5:17 pm, franca...@yahoo.com wrote:
public static String theMethod(Pageinfo pageinfo)
{
if (pageinfo!=null)
{
for(int i=0;i < 10;i++)
{
return "<a href=moveto.jsp?inpage=" + i + ">" + i +
"</a>";
}
}
return "";
}
You are returning after 1st iteration, that is why you see only 1
link.
Aside from this Manish's advice, ask yourself whether you're doing the
right thing in the first place. People try to avoid putting Java
scriptlets into their web pages. Try to learn the Java Standard Tag
Library; you'll find that you need to write less Java code to do your
tasks. After all, they're paying you to solve prolems, not to write
code.
In this case, it would be:
<c:forEach var="i" begin="${0}" end="${10}">
<c:url value="moveto.jsp" var="link">
<c:param name="inpage" value="${i}"/>
</c:url>
<a href='<c:out value="${link}"/>' >
<c:out value="${i}"/>
</a>
</cc:forEach>
</c:forEach>
--
Respectfully,
Eric Jablow- Hide quoted text -
- Show quoted text -
Thanks, great example. I cant get JSTL loaded due to restrictions but