You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kiran Badi <ki...@poonam.org> on 2015/01/10 05:19:29 UTC

Header and Footer file include struts 2

Hi

I need some help and I have to include header and footer file in Index
jsp.......

For some reason its not working and showing up source code in browser.

http://stackoverflow.com/questions/27220192/struts-2-sinclude-tag-not-working-for-header-jspf-file?noredirect=1#comment42946997_27220192

Appreciate if some one can take a look.

- Kiran

Re: Header and Footer file include struts 2

Posted by Tenchi Masaki <ko...@gmail.com>.
This was already pointed out at stackoverflow, but you're pointing out your
action result to a jsp fragment:

<result name="SUCCESS">/WEB-INF/views/header/header.jspf</result>

It doesn't make much sense. You should point it to a jsp that has the
fragment included in it. For example:

<result name="SUCCESS">/WEB-INF/views/success-result.jsp</result>

where success-result.jsp is a jsp file which includes your header.jspf
file.


How does one include header and footers across all pages in struts 2
> without using tiles?


Well, to make it in a neat way, I'd highly recommend using tiles. It's
pretty simple and elegant. One alternative is to use a template engine like
Velocity and use its macros to create your templates.

On Sat, Jan 10, 2015 at 3:35 AM, Kiran Badi <ki...@poonam.org> wrote:

> I have jspf fragments rather than jsp file.
>
> I did try with jsp also but same issue.
>
> How does one include header and footers across all pages in struts 2
> without using tiles?
> On Jan 10, 2015 12:31 AM, "Yaragalla Muralidhar" <
> yaragallamurali@gmail.com>
> wrote:
>
> > you have written
> >
> >  <result name="SUCCESS">/WEB-INF/views/header/header.jspf
> >
> >
> > i think it is not header.jspf it is header.jsp
> >
> >
> > *Thanks and Regards,*
> > Muralidhar Yaragalla.
> >
> > *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
> >
> > On Sat, Jan 10, 2015 at 10:42 AM, Kiran Badi <ki...@poonam.org> wrote:
> >
> > > I already have that in page but still getting error
> > >
> > > On Friday, January 9, 2015, Yaragalla Muralidhar <
> > > yaragallamurali@gmail.com>
> > > wrote:
> > >
> > > > if you are using struts tags add this to your jsp
> > > >
> > > > <%@ taglib prefix="s" uri="/struts-tags" %>
> > > >
> > > >
> > > >
> > > > *Thanks and Regards,*
> > > > Muralidhar Yaragalla.
> > > >
> > > > *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
> > > >
> > > > On Sat, Jan 10, 2015 at 9:49 AM, Kiran Badi <kiran@poonam.org
> > > > <javascript:;>> wrote:
> > > >
> > > > > Hi
> > > > >
> > > > > I need some help and I have to include header and footer file in
> > Index
> > > > > jsp.......
> > > > >
> > > > > For some reason its not working and showing up source code in
> > browser.
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> http://stackoverflow.com/questions/27220192/struts-2-sinclude-tag-not-working-for-header-jspf-file?noredirect=1#comment42946997_27220192
> > > > >
> > > > > Appreciate if some one can take a look.
> > > > >
> > > > > - Kiran
> > > > >
> > > >
> > >
> >
>

Re: Header and Footer file include struts 2

Posted by Kiran Badi <ki...@poonam.org>.
I have jspf fragments rather than jsp file.

I did try with jsp also but same issue.

How does one include header and footers across all pages in struts 2
without using tiles?
On Jan 10, 2015 12:31 AM, "Yaragalla Muralidhar" <ya...@gmail.com>
wrote:

> you have written
>
>  <result name="SUCCESS">/WEB-INF/views/header/header.jspf
>
>
> i think it is not header.jspf it is header.jsp
>
>
> *Thanks and Regards,*
> Muralidhar Yaragalla.
>
> *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
>
> On Sat, Jan 10, 2015 at 10:42 AM, Kiran Badi <ki...@poonam.org> wrote:
>
> > I already have that in page but still getting error
> >
> > On Friday, January 9, 2015, Yaragalla Muralidhar <
> > yaragallamurali@gmail.com>
> > wrote:
> >
> > > if you are using struts tags add this to your jsp
> > >
> > > <%@ taglib prefix="s" uri="/struts-tags" %>
> > >
> > >
> > >
> > > *Thanks and Regards,*
> > > Muralidhar Yaragalla.
> > >
> > > *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
> > >
> > > On Sat, Jan 10, 2015 at 9:49 AM, Kiran Badi <kiran@poonam.org
> > > <javascript:;>> wrote:
> > >
> > > > Hi
> > > >
> > > > I need some help and I have to include header and footer file in
> Index
> > > > jsp.......
> > > >
> > > > For some reason its not working and showing up source code in
> browser.
> > > >
> > > >
> > > >
> > >
> >
> http://stackoverflow.com/questions/27220192/struts-2-sinclude-tag-not-working-for-header-jspf-file?noredirect=1#comment42946997_27220192
> > > >
> > > > Appreciate if some one can take a look.
> > > >
> > > > - Kiran
> > > >
> > >
> >
>

Re: Header and Footer file include struts 2

Posted by Yaragalla Muralidhar <ya...@gmail.com>.
you have written

 <result name="SUCCESS">/WEB-INF/views/header/header.jspf


i think it is not header.jspf it is header.jsp


*Thanks and Regards,*
Muralidhar Yaragalla.

*http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*

On Sat, Jan 10, 2015 at 10:42 AM, Kiran Badi <ki...@poonam.org> wrote:

> I already have that in page but still getting error
>
> On Friday, January 9, 2015, Yaragalla Muralidhar <
> yaragallamurali@gmail.com>
> wrote:
>
> > if you are using struts tags add this to your jsp
> >
> > <%@ taglib prefix="s" uri="/struts-tags" %>
> >
> >
> >
> > *Thanks and Regards,*
> > Muralidhar Yaragalla.
> >
> > *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
> >
> > On Sat, Jan 10, 2015 at 9:49 AM, Kiran Badi <kiran@poonam.org
> > <javascript:;>> wrote:
> >
> > > Hi
> > >
> > > I need some help and I have to include header and footer file in Index
> > > jsp.......
> > >
> > > For some reason its not working and showing up source code in browser.
> > >
> > >
> > >
> >
> http://stackoverflow.com/questions/27220192/struts-2-sinclude-tag-not-working-for-header-jspf-file?noredirect=1#comment42946997_27220192
> > >
> > > Appreciate if some one can take a look.
> > >
> > > - Kiran
> > >
> >
>

Re: Header and Footer file include struts 2

Posted by Kiran Badi <ki...@poonam.org>.
I already have that in page but still getting error

On Friday, January 9, 2015, Yaragalla Muralidhar <ya...@gmail.com>
wrote:

> if you are using struts tags add this to your jsp
>
> <%@ taglib prefix="s" uri="/struts-tags" %>
>
>
>
> *Thanks and Regards,*
> Muralidhar Yaragalla.
>
> *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
>
> On Sat, Jan 10, 2015 at 9:49 AM, Kiran Badi <kiran@poonam.org
> <javascript:;>> wrote:
>
> > Hi
> >
> > I need some help and I have to include header and footer file in Index
> > jsp.......
> >
> > For some reason its not working and showing up source code in browser.
> >
> >
> >
> http://stackoverflow.com/questions/27220192/struts-2-sinclude-tag-not-working-for-header-jspf-file?noredirect=1#comment42946997_27220192
> >
> > Appreciate if some one can take a look.
> >
> > - Kiran
> >
>

Re: Header and Footer file include struts 2

Posted by Yaragalla Muralidhar <ya...@gmail.com>.
if you are using struts tags add this to your jsp

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



*Thanks and Regards,*
Muralidhar Yaragalla.

*http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*

On Sat, Jan 10, 2015 at 9:49 AM, Kiran Badi <ki...@poonam.org> wrote:

> Hi
>
> I need some help and I have to include header and footer file in Index
> jsp.......
>
> For some reason its not working and showing up source code in browser.
>
>
> http://stackoverflow.com/questions/27220192/struts-2-sinclude-tag-not-working-for-header-jspf-file?noredirect=1#comment42946997_27220192
>
> Appreciate if some one can take a look.
>
> - Kiran
>