You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by priya <pr...@gmail.com> on 2006/11/20 16:55:40 UTC

html:link newbie problem

This is probably a very simple question but this being my first struts
application its not that simple for me :)


   - I am using pagination on one of my jsp pages. There is a simple text
   box and 2 hidden fields (size, start) which do a search and calls
   search.do.
   - search.do passes attributes in its request object back to this jsp
   page. If there are attributes the results are shown.
   - If there are multiple results (> 10) then Next page link is shown.
   I am calling search again using the Next page link and passing a different
   start and size parameter which will handle pagination.
   - The parameters are converted to attributes in the search and
   returned to the jsp page


            <% java.util.HashMap map =new java.util.HashMap();
            map.put("size", String.valueOf(size));
            map.put("start",String.valueOf(start));
            pageContext.setAttribute("map",map);%>

            <%if (startWithNumber == 0) {%>Previous Page<%} else
{%><html:link page="/search.do" name="map"/>Previous Page<%}%>&nbsp; |
            <%if (nextPage == false) {%>Next Page<%} else {%><html:link
page="/search.do" name="map"/>Next Page</html:link><%}%>
            <br><br>

The problem is that even if I close the <html:link tag> the html shows up
like this

Previous Page&nbsp; | <a
href="/adam/search.do?size=10&amp;start=0"></a>Next Page</html:link>
<br><br>

so I cant click the link.. How do I get the Next Page inside the <a> tag?

Please do point out if there is a flaw in the way I am creating the link
itself. Your suggestions are much appreciated!

Priya

Re: html:link newbie problem

Posted by priya <pr...@gmail.com>.
Darn how did I miss that !

Thank you Elie and Wes!

On 11/20/06, Elie Ciment <ec...@gmail.com> wrote:
>
> priya,
>
> Your html:link (the "opening" tag) has incorrect syntax. You need to
> change
> it from
>
> <html:link page="/search.do" name="map"/>Next Page</html:link>
>
> to
>
> <html:link page="/search.do" name="map">Next Page</html:link>
>
> No extra "/" - that closes the tag in standard xhtml markup.
>
> That should fix it (also, fix up the Previous Page code to surround the
> words Previous Page with <html:link... >Previous Page</html:link>).
>
> Good luck...
>
> On 11/20/06, priya <pr...@gmail.com> wrote:
> >
> > This is probably a very simple question but this being my first struts
> > application its not that simple for me :)
> >
> >
> >    - I am using pagination on one of my jsp pages. There is a simple
> text
> >    box and 2 hidden fields (size, start) which do a search and calls
> >    search.do.
> >    - search.do passes attributes in its request object back to this jsp
> >    page. If there are attributes the results are shown.
> >    - If there are multiple results (> 10) then Next page link is shown.
> >    I am calling search again using the Next page link and passing a
> > different
> >    start and size parameter which will handle pagination.
> >    - The parameters are converted to attributes in the search and
> >    returned to the jsp page
> >
> >
> >             <% java.util.HashMap map =new java.util.HashMap();
> >             map.put("size", String.valueOf(size));
> >             map.put("start",String.valueOf(start));
> >             pageContext.setAttribute ("map",map);%>
> >
> >             <%if (startWithNumber == 0) {%>Previous Page<%} else
> > {%><html:link page="/search.do" name="map"/>Previous Page<%}%>&nbsp; |
> >             <%if (nextPage == false) {%>Next Page<%} else {%><html:link
> > page="/search.do" name="map"/>Next Page</html:link><%}%>
> >             <br><br>
> >
> > The problem is that even if I close the <html:link tag> the html shows
> up
> > like this
> >
> > Previous Page&nbsp; | <a
> > href="/adam/search.do?size=10&amp;start=0"></a>Next Page</html:link>
> > <br><br>
> >
> > so I cant click the link.. How do I get the Next Page inside the <a>
> tag?
> >
> > Please do point out if there is a flaw in the way I am creating the link
> > itself. Your suggestions are much appreciated!
> >
> > Priya
> >
> >
>
>

Re: html:link newbie problem

Posted by Elie Ciment <ec...@gmail.com>.
priya,

Your html:link (the "opening" tag) has incorrect syntax. You need to change
it from

<html:link page="/search.do" name="map"/>Next Page</html:link>

to

<html:link page="/search.do" name="map">Next Page</html:link>

No extra "/" - that closes the tag in standard xhtml markup.

That should fix it (also, fix up the Previous Page code to surround the
words Previous Page with <html:link... >Previous Page</html:link>).

Good luck...

On 11/20/06, priya <pr...@gmail.com> wrote:
>
> This is probably a very simple question but this being my first struts
> application its not that simple for me :)
>
>
>    - I am using pagination on one of my jsp pages. There is a simple text
>    box and 2 hidden fields (size, start) which do a search and calls
>    search.do.
>    - search.do passes attributes in its request object back to this jsp
>    page. If there are attributes the results are shown.
>    - If there are multiple results (> 10) then Next page link is shown.
>    I am calling search again using the Next page link and passing a
> different
>    start and size parameter which will handle pagination.
>    - The parameters are converted to attributes in the search and
>    returned to the jsp page
>
>
>             <% java.util.HashMap map =new java.util.HashMap();
>             map.put("size", String.valueOf(size));
>             map.put("start",String.valueOf(start));
>             pageContext.setAttribute("map",map);%>
>
>             <%if (startWithNumber == 0) {%>Previous Page<%} else
> {%><html:link page="/search.do" name="map"/>Previous Page<%}%>&nbsp; |
>             <%if (nextPage == false) {%>Next Page<%} else {%><html:link
> page="/search.do" name="map"/>Next Page</html:link><%}%>
>             <br><br>
>
> The problem is that even if I close the <html:link tag> the html shows up
> like this
>
> Previous Page&nbsp; | <a
> href="/adam/search.do?size=10&amp;start=0"></a>Next Page</html:link>
> <br><br>
>
> so I cant click the link.. How do I get the Next Page inside the <a> tag?
>
> Please do point out if there is a flaw in the way I am creating the link
> itself. Your suggestions are much appreciated!
>
> Priya
>
>