You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brett Porter <bp...@f2network.com.au> on 2001/11/29 22:57:56 UTC

RE: <%@ include File =" <%= includefile%> " %> is there a way doto this

<%@taglib uri='/WEB-INF/tlds/struts-bean.tld' prefix='bean' %>
<%@taglib uri='/WEB-INF/tlds/struts-logic.tld' prefix='logic' %>

<logic:present name='source'>
	<bean:define name='mysourcebean' id='source' scope='session'
toScope='page' type='SourceBean' />
	<bean:include id='content' page='<%= mysourcebean.getSource() %>' />
	<%= content %>
</logic:present>
<logic:notPresent name='source'>
	<%@include file="/welcome.jsp" %>
</logic:notPresent>

The logic:present parameters might not be right - its first up in the
morning :) You get the drift though.

To do it the way you were doing it, you could also have used <jsp:include
flush='true' page='<%= mysourcebean.getSource() %>' /> but I like the struts
way better :)

Cheers,
Brett

-----Original Message-----
From: Mohammed [mailto:dev4.java@panamp.de]
Sent: Thursday, 29 November 2001 10:49 PM
To: Struts Users Mailing List
Subject: <%@ include File =" <%= includefile%> " %> is there a way doto
this 


Hello evreybody,

in an action class SourceAction I am setting a variable in the session

SourceBean sourcebean = new SourceBean();
sourcebean.setSource(  myform.getcommand());
session.setAttribute("source", sourcebean);

in the jsp file I want to do the following

<%
SourceBean mysourcebean = (SourceBean)session.getAttribute("source");

if(mysourcebean!=null) {
String includefile= mysourcebean.getSource();
%>

<%@ include File ="  <%= includefile%>  %>    // this is not working ----->
ERROR:   file <%= includefile%> not found

<%}

else {%>
<%@ include File ="  welcome.jsp>  %>

<%}%>


Thanks for any help


Mohammed









--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>