You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by nmall <ha...@gmail.com> on 2007/08/30 18:00:06 UTC

jsp including another jsp

Hi Folks

 We are using Struts 2.0.6. We have a header.jsp which is included in each
of our jsp pages. 

 The header is tied to an action class to retrieve a name etc to display (
which changes depending on the login). 

However, the problem we are having is the information retrieved in the
action class by the header.jsp is not getting displayed in the header - it
shows a blank header.

It would show information in the action class tied in to the main jsp only.

Is this possible in Struts2. If not, what is the best way to accomplish
this.

Any help would be greatly appreciated.
Thanks!

-- 
View this message in context: http://www.nabble.com/jsp-including-another-jsp-tf4355201.html#a12410311
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: jsp including another jsp

Posted by nmall <ha...@gmail.com>.
That's good, thanks.   So I need specify the action tag inside the included
file header.jsp??

Also, we want to simply store and get attributes from the session instead of
executing an action each time for this header. We tried doing
#session.<blah> but it doesn't work in the header, although it works in
other pages.

We assumed that the struts.xml spec tells struts ( including the included
jsp) which action to  execute for which jsp.

Thanks!


newton.dave wrote:
> 
> All you're doing is including a JSP via a standard JSP
> directive; no action is being executed.
> 
> You might want to look at the <s:action.../> tag [1].
> 
> d.
> 
> [1] http://struts.apache.org/2.x/docs/action.html
> 
> --- nmall <ha...@gmail.com> wrote:
> 
>> 
>> header is simply a jsp page called header.jsp. There
>> are tabs in the header
>> page and that is being displayed correctly. This is
>> our header page ( i have
>> attached header1.jsp)
>> 
>> <%@ taglib prefix="s" uri="/struts-tags" %>
>> 
>> <html>
>>   <head>
>> http://www.nabble.com/file/p12411297/header1.jsp
>> header1.jsp 
>>     <title>Header Page</title>
>>      <%@ include file="header1.jsp" %>
>>   </head>
>>   <body>
>>   <h1></h1>
>>   </body>
>> </html>
>> 
>>  <action name="header"
>>
> class="com.siteacuity.webapp.action.CurrentDetailsAction">
>>             <result
>> name="success">/WEB-INF/pages/header.jsp</result> 
>>         </action> 
>> We have included this header.jsp in other pages (
>> where we need to display a
>> few fields got from CurrentDetailsAction.
>> 
>> <%@ taglib prefix="s" uri="/struts-tags" %>
>> 
>> <html>
>>   <head>
>>     <title>Current Details</title>
>>     <script type="text/javascript">
>> document.write('<style
>> type="text/css">.tabber{display:none;}<\/style>');
>> </script>
>> <%@ include file="header.jsp" %>
>> </head>
>> <body>
>> 
>> Thanks a lot. We need this basic header to work for
>> all of our pages.
>> 
>> 
>> 
>> 
>> newton.dave wrote:
>> > 
>> > --- nmall <ha...@gmail.com> wrote:
>> >> We are using Struts 2.0.6. We have a header.jsp
>> >> which is included in each of our jsp pages. 
>> >> The header is tied to an action class to retrieve
>> a
>> >> name etc to display (which changes depending on
>> the 
>> >> login). 
>> > 
>> > How is it "tied to an action class"? How are you
>> > including it? Is there any HTML from the header
>> file
>> > at all, or is it missing entirely?
>> > 
>> > d.
>> > 
>> > 
>> >
>>
> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail:
>> user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail:
>> user-help@struts.apache.org
>> > 
>> > 
>> > 
>> 
>> -- 
>> View this message in context:
>>
> http://www.nabble.com/jsp-including-another-jsp-tf4355201.html#a12411297
>> Sent from the Struts - User mailing list archive at
>> Nabble.com.
>> 
>> 
>>
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> user-unsubscribe@struts.apache.org
>> For additional commands, e-mail:
>> user-help@struts.apache.org
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/jsp-including-another-jsp-tf4355201.html#a12411793
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: jsp including another jsp

Posted by Dave Newton <ne...@yahoo.com>.
All you're doing is including a JSP via a standard JSP
directive; no action is being executed.

You might want to look at the <s:action.../> tag [1].

d.

[1] http://struts.apache.org/2.x/docs/action.html

--- nmall <ha...@gmail.com> wrote:

> 
> header is simply a jsp page called header.jsp. There
> are tabs in the header
> page and that is being displayed correctly. This is
> our header page ( i have
> attached header1.jsp)
> 
> <%@ taglib prefix="s" uri="/struts-tags" %>
> 
> <html>
>   <head>
> http://www.nabble.com/file/p12411297/header1.jsp
> header1.jsp 
>     <title>Header Page</title>
>      <%@ include file="header1.jsp" %>
>   </head>
>   <body>
>   <h1></h1>
>   </body>
> </html>
> 
>  <action name="header"
>
class="com.siteacuity.webapp.action.CurrentDetailsAction">
>             <result
> name="success">/WEB-INF/pages/header.jsp</result> 
>         </action> 
> We have included this header.jsp in other pages (
> where we need to display a
> few fields got from CurrentDetailsAction.
> 
> <%@ taglib prefix="s" uri="/struts-tags" %>
> 
> <html>
>   <head>
>     <title>Current Details</title>
>     <script type="text/javascript">
> document.write('<style
> type="text/css">.tabber{display:none;}<\/style>');
> </script>
> <%@ include file="header.jsp" %>
> </head>
> <body>
> 
> Thanks a lot. We need this basic header to work for
> all of our pages.
> 
> 
> 
> 
> newton.dave wrote:
> > 
> > --- nmall <ha...@gmail.com> wrote:
> >> We are using Struts 2.0.6. We have a header.jsp
> >> which is included in each of our jsp pages. 
> >> The header is tied to an action class to retrieve
> a
> >> name etc to display (which changes depending on
> the 
> >> login). 
> > 
> > How is it "tied to an action class"? How are you
> > including it? Is there any HTML from the header
> file
> > at all, or is it missing entirely?
> > 
> > d.
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context:
>
http://www.nabble.com/jsp-including-another-jsp-tf4355201.html#a12411297
> Sent from the Struts - User mailing list archive at
> Nabble.com.
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: jsp including another jsp

Posted by nmall <ha...@gmail.com>.
header is simply a jsp page called header.jsp. There are tabs in the header
page and that is being displayed correctly. This is our header page ( i have
attached header1.jsp)

<%@ taglib prefix="s" uri="/struts-tags" %>

<html>
  <head> http://www.nabble.com/file/p12411297/header1.jsp header1.jsp 
    <title>Header Page</title>
     <%@ include file="header1.jsp" %>
  </head>
  <body>
  <h1></h1>
  </body>
</html>

 <action name="header"
class="com.siteacuity.webapp.action.CurrentDetailsAction">
            <result name="success">/WEB-INF/pages/header.jsp</result> 
        </action> 
We have included this header.jsp in other pages ( where we need to display a
few fields got from CurrentDetailsAction.

<%@ taglib prefix="s" uri="/struts-tags" %>

<html>
  <head>
    <title>Current Details</title>
    <script type="text/javascript">
document.write('<style type="text/css">.tabber{display:none;}<\/style>');
</script>
<%@ include file="header.jsp" %>
</head>
<body>

Thanks a lot. We need this basic header to work for all of our pages.




newton.dave wrote:
> 
> --- nmall <ha...@gmail.com> wrote:
>> We are using Struts 2.0.6. We have a header.jsp
>> which is included in each of our jsp pages. 
>> The header is tied to an action class to retrieve a
>> name etc to display (which changes depending on the 
>> login). 
> 
> How is it "tied to an action class"? How are you
> including it? Is there any HTML from the header file
> at all, or is it missing entirely?
> 
> d.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/jsp-including-another-jsp-tf4355201.html#a12411297
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: jsp including another jsp

Posted by Dave Newton <ne...@yahoo.com>.
--- nmall <ha...@gmail.com> wrote:
> We are using Struts 2.0.6. We have a header.jsp
> which is included in each of our jsp pages. 
> The header is tied to an action class to retrieve a
> name etc to display (which changes depending on the 
> login). 

How is it "tied to an action class"? How are you
including it? Is there any HTML from the header file
at all, or is it missing entirely?

d.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org