Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Tiles in struts?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
i am working on tiles,i did a sample application on tiles just to display all other pages from a template page,it worked.but now i have a left menu in a layout where i have given links(hrefs) to all other pages.if i click on the links ,its working fine but it will not display in layout.whether i have to use putList or what?please explain to change contents(pages)in an application using my left menu options(ie, hrefs).
please post reply.
THANKS IN ADVANCE
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what the question really is, by I'll try to help.

Lets say you want an application with a left hand navigation and to the right of that will be the body. Well to make it more realistic we'll throw a header and a footer in the mix.

siteLayout.jsp


Now for the tile definitions. Note that the header and navigation are generated dynamically, so they will reference a .do, the footer is static content, so it will reference the JSP.

tiles-defs.xml:


link1 and link2 are dynamically generated, so the action will point to a reference in the struts-config.xml and that will in turn point to the tile-defs.xml to reference its JSP.

struts-config.xml snippet:


I'm not sure if that's what you were looking for, but hope it helps.

-Chris
 
Marshal
Posts: 67388
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Amith BN",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. Initials for a last name are not acceptable.

Thanks!
bear
JavaRanch Sheriff
[ November 10, 2006: Message edited by: Bear Bibeault ]
 
amith amith
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi chris,
Thanks for the example,but the thing is that i am using(<tiles:insert definition="index.page" /> in Jsp page to include the content.
in detail:
1>i have a left navigation where i have given 4 href to go to other pages like addemployee,listemployee,designation....etc
2>my template look like this

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<html>
<table border="1" cellpadding="0" cellspacing="0" width="100%" height="100% bordercolor="#000000" bgcolor="#E7FDFE">
<tr>
<td width="100%" colspan="2" valign="top"><tiles:insert attribute="header"/></td>
</tr>
<tr>
<td width="23%" valign="center" ><tiles:insert attribute="navigation"/></td>
<td width="77%" valign="top" ><tiles:insert attribute="body"/></td>
</tr>
<tr>
<td width="100%" colspan="2" valign="top"><tiles:insert attribute="bottom"/></td>
</tr>
</table>
</html>

3>my tiles-defs.Xml look like this

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">;

<tiles-definitions>
<definition name="example" page="/template.jsp">
<put name="header" value="/header.jsp" />
<put name="body" value="body.do"/>
<put name="navigation" value="/navigation.jsp" />
<put name="bottom" value="/footer.jsp" />
</definition>

<definition name="index.page" extends="example" >
<put name="body" value="/Department.jsp" />
</definition>
</tiles-definitions>
MY PROBLEM IS:
i am getting tiles layout with navigation,header,footer,body(simple static page),but when i click on the link(hrefs) i am getting my content(Department.jsp) displayed outside the layout.


HELP ME CHRIS>>>>>>>>>>>>>
 
author
Posts: 4173
29
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Amith B.N"

Your name is still not correct. Please correct it right away to avoid account suspension.

-Scott
 
Chris Boldon
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each linked page you're going to should have its own definition.

IE:


Also, looking at index.page I see something that may be a problem. In the base definition (example) to add body with a value. Then in index.page you give body a value, while at the same time inheriting a body value from example. You are going to be specifying a different body in each page, so I would pull it out of the base def..you'll have to make changes to your struts-config more than likely when you do this as well.

Hope it helps,
Chris

PS,
Like they say, you're going to have to change your name to something that looks like a real full name. This is a great community for getting help and it's about the only rule enforced.
[ November 13, 2006: Message edited by: Chris Boldon ]
 
Scott Selikoff
author
Posts: 4173
29
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Amith"

Please review our naming policy one more time. In particular, names must be made up of a first name or initial followed by a last name.

-Scott
 
Scott Selikoff
author
Posts: 4173
29
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"amith amith"

Your name still does not conform to our naming policy. You have been warned 3 separate times before and this is your final warning.
 
Bear Bibeault
Marshal
Posts: 67388
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"amith amith",

Your account has been disabled. Should you wish to reinstate your account please contact me via email.

bear
JavaRanch Sheriff
 
straws are for suckers. tiny ads are for attractive people.
ScroogeXHTML 8.7 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/730700/ScroogeXHTML-RTF-HTML-XHTML-converter
    Bookmark Topic Watch Topic
  • New Topic