Struts Tiles Question
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Tuesday, November 14, 2006 11:35 AM

Hi, When a user connects to my web site, he needs to be forwarded to index.jsp. The problem is that the menu on the left changes wether he is logged or not. (check : http://www.lehall.org) Whitout the Struts Tiles, I had no problems : all I did is " if session.getAttribute("user") == null include menuNotLogged.jsp else include menuLogged.jsp " But since I use Struts Tiles, i had to separate the index page into two Jsp's : - indexLoggedon.jsp (insert definition model loggedon) - index   More>>

Hi,


When a user connects to my web site,

he needs to be forwarded to index.jsp.



The problem is that the menu on the left changes wether he is logged or not.

(check : http://www.lehall.org)

Whitout the Struts Tiles, I had no problems : all I did is

"

if session.getAttribute("user") == null

include menuNotLogged.jsp

else

include menuLogged.jsp

"

But since I use Struts Tiles,

i had to separate the index page into two Jsp's :

- indexLoggedon.jsp (insert definition model loggedon)

- indexLoggedoff.jsp (insert definition model loggedoff)

I needed to separate the index in two files because I
defined a model layout with a menu *not logged*, and a menu *logged*.


So when a guest *and* an authenticated user can both access to one webpage,

I need _loggedoff.jsp,
_loggedon.jsp since I use Tiles.


*******************************************************


Here is my tiles definition xml :


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



"-//Apache Software Foundation//DTD Tiles Configuration//EN"

"D:/Informatique/Projets/LeHall/WorkSpace LeHall/LeHallWeb v2/WebContent/WEB-INF/dtds/tiles-config.dtd">















































value="/incl/menu2/loggedon.jsp"/>


































[...]





*******************************************************

And my layout base.jsp :









charset=ISO-8859-1">





















key="global.title"/>











































*******************************************************



So per consequent I need two files :



index_loggedoff.jsp :



<%@ page language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<%@ taglib uri="struts-tiles" prefix="tiles" %>








*******************************************************



index_loggedon.jsp :



<%@ page language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<%@ taglib uri="struts-tiles" prefix="tiles" %>








Is this the way to do it ?

Or am I doing something wrong ?




I have a supplementary question,

as u can see in base.jsp, my layout, I included *all* the CSS,

I can't find another solution for this,

this is pretty annoying.



Any help is appreciated !

Thank u !


   <<Less
About | Sitemap | Contact