Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Struts html:link

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have some html links in my jsp page which when clicked should send me to another section on the same page.

1. When i use html anchors directly <a></a> (I am using Struts along with tiles) it always tries to reload the page based on the definition in tiles.

The problem is I dont want it to reload the page as I need to supply all the request parameters that have been passed earlier to the page. Rather i would want it to just take to me the corresponding section on the same page (just how a normal anchor works when no struts or tiles are used)

Things work fine when no tiles are used.

Is there any way I can do this. Is there a struts tag which just takes me to a different section of the same page without reloading.

Thanks
 
Sheriff
Posts: 16767
281
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using a full URL or a relative one? I would think a relative URL would prevent a trip to the server.

relative URL:

<a href="#section2">Section 2</a>

vs. full URL:

<a href="MyPage.do#section2">Section 2</a>
 
A Tata
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried both relative and absolute URL but doesnt help.

I think the problem is with the usage of tiles where i define my header and footer and the body in a Layout.jsp

When i use relative URL(<a href="#output></a> in a given file it is going to the Layout.jsp as opposed to the file itself. This is causing a problem.

Absolute URL ofcourse is doing what it is supposed to do. - reload the page.

Tried struts html:link page and other attributes - All of them reload the page.

I want to know if there is any struts tag or anything else that prevents this reloading but just takes me to a different section in the same page when using struts and Tiles.

Thanks
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic