Meaningless Drivel is fun!*
The moose likes Struts and the fly likes calling new jsp from tiles:insert attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "calling new jsp from tiles:insert attribute" Watch "calling new jsp from tiles:insert attribute" New topic
Author

calling new jsp from tiles:insert attribute

vika mishra
Greenhorn

Joined: Feb 11, 2010
Posts: 12
In our "baseLayout.jsp" we have 'accueil'/insert attribute which is not able to call authentification.jsp :-
<td valign='middle'><tiles:insert attribute='accueil'/></td>



The attribute 'accueil'/ is mapped to authetification.jsp in tiles-config.xml file.

<!-- Authentification Page definition -->

<definition name=".authentification" extends="baseLayout">

<put name="document.title" value="Ocean Authentication Page"/>

<put name="accueil" value="/common/authentification.jsp"/>

</definition>

The struts-config.xml has entry of tiles-config.xml

<!-- Plugin pour l'utilisation des Tiles Struts -->

<plug-in className="org.apache.struts.tiles.TilesPlugin" >

<set-property property="definitions-config" value="/WEB-INF/tiles-config.xml" />

<set-property property="definitions-debug" value="2" />

<set-property property="definitions-parser-details" value="2" />

<set-property property="definitions-parser-validate" value="true" />

</plug-in>


Can someone could suggest what could be the problem as the "baseLayout.jsp" is not able to call "authentification.jsp".

Although if we are going directly to authentification.jsp then we are able to login and navigate inside the application.




David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Do any other tile definitions work?
vika mishra
Greenhorn

Joined: Feb 11, 2010
Posts: 12
Actually on our baseLayout.jsp the line
<td valign='middle'><tiles:insert attribute='accueil'/></td>

is not inserting its attribute but if we we paste it two times then it is inserting value but copying the header two times
vika mishra
Greenhorn

Joined: Feb 11, 2010
Posts: 12
Adding baseLayout.jsp code
vika mishra
Greenhorn

Joined: Feb 11, 2010
Posts: 12
<%-- Include common set of tag library declarations for each layout --%>
<%@ include file="/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%-- Set all pages that include this page (particularly tiles) to use XHTML --%>
<html:xhtml />
<% if (session != null)
{
%>
<script>
history.forward();
</script>
<%
}
%>
<html:html xhtml="true" locale="true">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Cache-Control" content="no-cache"/>

<title><tiles:getAsString name='document.title' ignore="true"/></title>

<%-- Get Javascript List --%>
<tiles:useAttribute id="scriptList" name="scripts"
classname="java.util.List" ignore="true"/>

<c:forEach var="js" items="${scriptList}">
<script type="text/javascript"
src="<c:url value="${js}"/>"></script>
</c:forEach>


<%-- Get List of Stylesheets --%>
<tiles:useAttribute id="styleList" name="styles"
classname="java.util.List" ignore="true"/>

<c:forEach var="css" items="${styleList}">
<link rel="stylesheet" type="text/css" media="all"
href="<c:url value="${css}"/>" />
</c:forEach>

</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#c0daef">
<script>
alert('hi baselayout');
</script>
<tr>

<tiles:insert attribute='hhh' />
</tr>

</body>
</html:html>
vika mishra
Greenhorn

Joined: Feb 11, 2010
Posts: 12
adding authentification.jsp
vika mishra
Greenhorn

Joined: Feb 11, 2010
Posts: 12
<%@ include file="taglibs.jsp"%>


<% String messageErr="errors.logon.connect" ;
if (request.getAttribute("messageError")!= null && request.getAttribute("messageError")!= ""){
messageErr = (String)request.getAttribute("messageError");
}
%>

<script type="text/javascript" language="Javascript1.1">

function openWindow()
{
alert ('<bean:message key="<%=messageErr%>"/>');
}

// On vérifie si l'ecran est situé dans une popup
// dans cette cas, on ferme et renvoye le login au opener
// On vérifie seulement deux niveaus car c'est le maximum possible dans l'appli.
if (opener && opener.dialogWin && opener.dialogWin.win == window)
{
// si l'ecran est situé dans une popup
var target = opener
if (opener.opener && opener.opener.dialogWin && opener.opener.dialogWin.win == window)
{
// si le popup vient d'une autre popup
target = opener.opener
}

// login page
target.document.location.href='<%=strContextPath%>/'

// auto-ferme
close()
}
</script>
<html:form action="/login.do" focus="login">

<logic:messagesPresent>
<body onload="openWindow();" >
</logic:messagesPresent>

<logic:messagesNotPresent>
<body>
</logic:messagesNotPresent>

<table width="100%" border="0" cellspacing="0" cellpadding="0"
bgcolor="#333333" height="67">
<tr>
<td width="937" height="67" valign="middle"
background="<%=strImagesPath%>/LOGO.gif"> </td>
<td width="33" align="center" valign="middle"
background="<%=strImagesPath%>/bg_bleu_5.gif"> </td>
<td width="25" align="center" valign="middle"
background="<%=strImagesPath%>/bg_bleu_5.gif"> </td>
</tr>
</table>
<table width="100%" height="500" border="0" cellspacing="0"
cellpadding="0" leftmargin="0" topmargin="0" class="stylZCtext">
<tr>
<td valign="middle" width="965" height="500">
<table width="325" height="185" align="center" class="stylZCtext"
cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<!--Partie basse -->
<tr>
<td width="60%">
<table align="center" width="310" height="169" border="0"
cellpadding="0" cellspacing="0" class="Ta">
<tr>
<td width="54%" height="20" class="TiTa">
<div align="left" style="font-size: 8pt"> <bean:message
key="label.autentification" /></div>
</td>
<td width="46%" height="20" class="TiTa">
<div align="center"></div>
</td>
</tr>
<tr>
<td height="20" class="TeTaB"> </td>
<td height="20" class="TeTaB"> </td>
</tr>
<tr>
<td width="54%" height="24" class="TeTaB">
<div align="right"><bean:message key="label.login" />  :
 </div>
</td>
<td width="46%" height="24" class="TeTaB">
<div align="left"><html:text property="login" size="16"
maxlength="50" /></div>
</td>
</tr>
<tr>
<td width="54%" height="24" class="TeTaB">
<div align="right"><bean:message key="label.password" />  :
 </div>
</td>
<td width="46%" height="24" class="TeTaB">
<div align="left"><html:password property="password" size="16"
maxlength="30" /></div>
</td>
</tr>
<tr>
<td width="54%" class="TeTaB" align="center"><img
src="<%=strImagesPath%>/phone_modem1d.gif" border="0"></td>
<td width="46%" class="TeTaB">
<table>
<tr>
<td height="50%" class="TeTaB">
<div align="right"><html:submit property="submit"
value="Valider" styleClass="stylBtnLog" /></div>
</td>
<td height="50%" class="TeTaB">
<div align="center"><html:reset value="Annuler"
styleClass="stylBtnLog" /></div>
</td>
</tr>
<tr>
<td height="25%"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="TeTaB" align="center"> </td>
<td class="TeTaB"> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html:form>
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.
 
Don't get me started about those stupid light bulbs.
 
subject: calling new jsp from tiles:insert attribute
 
Similar Threads
Struts1.3 tiles problem
tiles XML definition help
Tiels tags are not processing
Trying to use Tiles--Little success :-(
struts tiles 1.3.8