On Aug 30, 5:17 pm, franca...@yahoo.com wrote:
> public static String theMethod(Pageinfo pageinfo)
> {
[quoted text clipped - 8 lines]
> return "";
> }
You are returning after 1st iteration, that is why you see only 1
link.
Use a variable to buffer the text and then return it after the loop is
over. Like:
public static String theMethod(Pageinfo pageinfo)
{
StringBuffer buffer = new StringBuffer();
if (pageinfo!=null)
{
for(int i=0;i < 10;i++)
{
buffer.append("<a href=moveto.jsp?inpage=" + i + ">"
+ i +
"</a>");
}
}
return buffer.toString();
}
-cheers,
Manish
Eric Jablow - 02 Sep 2007 06:41 GMT
> On Aug 30, 5:17 pm, franca...@yahoo.com wrote:
> > public static String theMethod(Pageinfo pageinfo)
[quoted text clipped - 12 lines]
> 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>

Signature
Respectfully,
Eric Jablow
francan00@yahoo.com - 05 Sep 2007 23:42 GMT
> > On Aug 30, 5:17 pm, franca...@yahoo.com wrote:
> > > public static String theMethod(Pageinfo pageinfo)
[quoted text clipped - 36 lines]
>
> - Show quoted text -
Thanks, great example. I cant get JSTL loaded due to restrictions but
working on getting it within a year.