File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Use <s:url> or use <jsp:include> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Use <s:url> or use <jsp:include>" Watch "Use <s:url> or use <jsp:include>" New topic

Use <s:url> or use <jsp:include>

Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Hi everyone, I am new and interested in Struts 2, apologize that perhaps I should do more research it myself. But if anyone can offer any opinions, it would be awesome.

If I want to like include company banner on my app and maybe inherit the style from company site by writing or pasting the least amount of code, should I use <s:url> or should I use <jsp:include> ?

by the way, where should I place the included file to be consider the best practice in modern Web Application. My initial guess is a subfolder under /WEB_INF/

thanks for the input
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I think you're misunderstanding the use of the s:url tag. This tag does nothing more than create a variable that is a formatted URL that could then be used by some other tag or scriptlet. It doesn't actually include any content on the page. If you want to include something on each page, then a jsp:include would work. You also have the option of using Struts Tiles.

Consultant, Sima Solutions
I agree. Here's the link:
subject: Use <s:url> or use <jsp:include>
It's not a secret anymore!