You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kishan G. Chellap Paandy" <ki...@spanservices.com> on 2009/04/28 09:06:39 UTC

Struts 2.1.6 - Alternative Template Engines - JSP

Hi,

I'm using Struts 2.1.6.

I'm developing custom Struts 2.1.6 tags.

I want to use org.apache.struts2.components.template.JspTemplateEngine.

The framework supports three template engines, which can be controlled
by the struts.ui.templateSuffix in struts.properties.

If I set the above, does all the struts2 tags and the custom tags I'm
developing will use the JSPTemplateEngine? 

I want to use JSPTemplateEngine only for some custom tags I'm developing
and I will use FreemarkerTemplateEngine for some other custom tags. Is
this possible?

Thank you.
Regards,
Kishan.G

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


RE: Struts 2.1.6 - Alternative Template Engines - JSP

Posted by "Kishan G. Chellap Paandy" <ki...@spanservices.com>.
If that is the case, 

I'm setting struts.ui.templateSuffix=jsp in struts.properties. 

And, in the struts 2 tags, take for example ComboBox, does it expects
combobox.jsp to be present in the templateDir?
(Since combobox is the name of the template for the combobox tag and
JspTemplateEngine class renderTemplate method is making use of
getFinalTemplateName method in BaseTemplateEngine which suffix ".jsp" to
the template) 

In that case do all the struts 2 tags will expect their corresponding
template suffixed with ".jsp" in the templateDir? So, it means that I
have to practically override/convert all the ".ftl" templates to ".jsp"
for all the struts 2 tags in order to make them work? And whatever
struts 2 custom tags I'm developing should have templates suffixed with
".jsp"?

Please clarify.

Thank you.
Regards,
Kishan.G
 
Senior Software Engineer.
www.spansystems.com



-----Original Message-----
From: Musachy Barroso [mailto:musachy@gmail.com] 
Sent: Wednesday, April 29, 2009 11:30 PM
To: Struts Users Mailing List
Subject: Re: Struts 2.1.6 - Alternative Template Engines - JSP

it sets the engine used by the tags.

musachy

On Wed, Apr 29, 2009 at 1:27 AM, Kishan G. Chellap Paandy
<ki...@spanservices.com> wrote:
> Hi Musachy,
>
> Thanks for your reply.
>
> I was wondering what is the significance of struts.ui.templateSuffix
is?
>
> Please advice.
>
> Thank you.
> Regards,
> Kishan.G
>
> Senior Software Engineer.
> www.spansystems.com
>
>
>
> -----Original Message-----
> From: Musachy Barroso [mailto:musachy@gmail.com]
> Sent: Tuesday, April 28, 2009 6:37 PM
> To: Struts Users Mailing List
> Subject: Re: Struts 2.1.6 - Alternative Template Engines - JSP
>
> The template engines just process certain types of templates(ftl, vm,
> jsp, etc), but are not(directly) related to tags. The tags need to
> output something, what you use to generate the output is up to you,
> the struts tags use freemarker, but the javatemplates plugin uses
> plain java, for example.
>
> musachy
>
> On Tue, Apr 28, 2009 at 3:06 AM, Kishan G. Chellap Paandy
> <ki...@spanservices.com> wrote:
>> Hi,
>>
>> I'm using Struts 2.1.6.
>>
>> I'm developing custom Struts 2.1.6 tags.
>>
>> I want to use
> org.apache.struts2.components.template.JspTemplateEngine.
>>
>> The framework supports three template engines, which can be
controlled
>> by the struts.ui.templateSuffix in struts.properties.
>>
>> If I set the above, does all the struts2 tags and the custom tags I'm
>> developing will use the JSPTemplateEngine?
>>
>> I want to use JSPTemplateEngine only for some custom tags I'm
> developing
>> and I will use FreemarkerTemplateEngine for some other custom tags.
Is
>> this possible?
>>
>> Thank you.
>> Regards,
>> Kishan.G
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> 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
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
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: Struts 2.1.6 - Alternative Template Engines - JSP

Posted by Musachy Barroso <mu...@gmail.com>.
it sets the engine used by the tags.

musachy

On Wed, Apr 29, 2009 at 1:27 AM, Kishan G. Chellap Paandy
<ki...@spanservices.com> wrote:
> Hi Musachy,
>
> Thanks for your reply.
>
> I was wondering what is the significance of struts.ui.templateSuffix is?
>
> Please advice.
>
> Thank you.
> Regards,
> Kishan.G
>
> Senior Software Engineer.
> www.spansystems.com
>
>
>
> -----Original Message-----
> From: Musachy Barroso [mailto:musachy@gmail.com]
> Sent: Tuesday, April 28, 2009 6:37 PM
> To: Struts Users Mailing List
> Subject: Re: Struts 2.1.6 - Alternative Template Engines - JSP
>
> The template engines just process certain types of templates(ftl, vm,
> jsp, etc), but are not(directly) related to tags. The tags need to
> output something, what you use to generate the output is up to you,
> the struts tags use freemarker, but the javatemplates plugin uses
> plain java, for example.
>
> musachy
>
> On Tue, Apr 28, 2009 at 3:06 AM, Kishan G. Chellap Paandy
> <ki...@spanservices.com> wrote:
>> Hi,
>>
>> I'm using Struts 2.1.6.
>>
>> I'm developing custom Struts 2.1.6 tags.
>>
>> I want to use
> org.apache.struts2.components.template.JspTemplateEngine.
>>
>> The framework supports three template engines, which can be controlled
>> by the struts.ui.templateSuffix in struts.properties.
>>
>> If I set the above, does all the struts2 tags and the custom tags I'm
>> developing will use the JSPTemplateEngine?
>>
>> I want to use JSPTemplateEngine only for some custom tags I'm
> developing
>> and I will use FreemarkerTemplateEngine for some other custom tags. Is
>> this possible?
>>
>> Thank you.
>> Regards,
>> Kishan.G
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> 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
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


RE: Struts 2.1.6 - Alternative Template Engines - JSP

Posted by "Kishan G. Chellap Paandy" <ki...@spanservices.com>.
Hi Musachy,

Thanks for your reply.

I was wondering what is the significance of struts.ui.templateSuffix is?

Please advice.

Thank you.
Regards,
Kishan.G
 
Senior Software Engineer.
www.spansystems.com



-----Original Message-----
From: Musachy Barroso [mailto:musachy@gmail.com] 
Sent: Tuesday, April 28, 2009 6:37 PM
To: Struts Users Mailing List
Subject: Re: Struts 2.1.6 - Alternative Template Engines - JSP

The template engines just process certain types of templates(ftl, vm,
jsp, etc), but are not(directly) related to tags. The tags need to
output something, what you use to generate the output is up to you,
the struts tags use freemarker, but the javatemplates plugin uses
plain java, for example.

musachy

On Tue, Apr 28, 2009 at 3:06 AM, Kishan G. Chellap Paandy
<ki...@spanservices.com> wrote:
> Hi,
>
> I'm using Struts 2.1.6.
>
> I'm developing custom Struts 2.1.6 tags.
>
> I want to use
org.apache.struts2.components.template.JspTemplateEngine.
>
> The framework supports three template engines, which can be controlled
> by the struts.ui.templateSuffix in struts.properties.
>
> If I set the above, does all the struts2 tags and the custom tags I'm
> developing will use the JSPTemplateEngine?
>
> I want to use JSPTemplateEngine only for some custom tags I'm
developing
> and I will use FreemarkerTemplateEngine for some other custom tags. Is
> this possible?
>
> Thank you.
> Regards,
> Kishan.G
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
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:Re: How to forward request in struts 2.1.6?

Posted by xnpeng <xn...@163.com>.
by the idea of Convention-plugin(CodeBehind-plugin)--"Zero Config",it provides:
Action location by package naming conventions 
Result (JSP, FreeMarker, etc) location by naming conventions 
Class name to URL naming convention 
Package name to namespace convention 
SEO compliant URLs (i.e. my-action rather than MyAction) 
the normal mappings don't work in the REST-plugin environment.




在2009-05-01,"Dave Newton" <ne...@yahoo.com> 写道:
>xnpeng wrote:
>> public class PublishController extends PublishAction implements Preparable {
>>     private static String message_url = "/post/message/";
>>     private static String affair_url = "/post/affair/";
>>     private static String business_url = "/post/business/";
>>     private static String activity_url = "/post/activity/";
>>     private static String announce_url = "/post/announce/";
>>     private static String house_url = "/post/house/";
>>     private static String case_url = "/post/case/";
>>     private static String scenery_url = "/post/scenery/";
>>     private static String poll_url = "/post/poll/";
>> 
>>         if (category != null) {
>>             if (category.getCateId().equalsIgnoreCase(Category.MESSAGE)) {
>>                 ServletActionContext.getResponse()
>>                         .sendRedirect(ServletActionContext.getRequest().getContextPath() + message_url + "new");
>>             } else if (category.getCateId().equalsIgnoreCase(Category.AFFAIR)) {
>>                 ServletActionContext.getResponse()
>>                         .sendRedirect(ServletActionContext.getRequest().getContextPath() + affair_url + "new");
> > [...snip...]
>
>I'm not sure I understand the issue either, but man, isn't this what 
>maps were made for?!
>
>Dave
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

Re: How to forward request in struts 2.1.6?

Posted by Dave Newton <ne...@yahoo.com>.
xnpeng wrote:
> public class PublishController extends PublishAction implements Preparable {
>     private static String message_url = "/post/message/";
>     private static String affair_url = "/post/affair/";
>     private static String business_url = "/post/business/";
>     private static String activity_url = "/post/activity/";
>     private static String announce_url = "/post/announce/";
>     private static String house_url = "/post/house/";
>     private static String case_url = "/post/case/";
>     private static String scenery_url = "/post/scenery/";
>     private static String poll_url = "/post/poll/";
> 
>         if (category != null) {
>             if (category.getCateId().equalsIgnoreCase(Category.MESSAGE)) {
>                 ServletActionContext.getResponse()
>                         .sendRedirect(ServletActionContext.getRequest().getContextPath() + message_url + "new");
>             } else if (category.getCateId().equalsIgnoreCase(Category.AFFAIR)) {
>                 ServletActionContext.getResponse()
>                         .sendRedirect(ServletActionContext.getRequest().getContextPath() + affair_url + "new");
 > [...snip...]

I'm not sure I understand the issue either, but man, isn't this what 
maps were made for?!

Dave


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


Re:Re: Re: How to forward request in struts 2.1.6?

Posted by xnpeng <xn...@163.com>.
so many thanks.
forgive my poor english.
 
there are some words in this document:
http://struts.apache.org/2.1.6/docs/rest-plugin.html



Also, notice we aren't returning the usual "success" result code in either method. This allows us to use the special features of the Codebehind Plugin to intuitively select the result template to process when this resource is accessed with the .xhtml extension. In this case, we can provide a customized XHTML view of the resource by creating /orders-show.jsp and /orders-update.jsp for the respective methods.

my code is like this:

package com.xunan.sitexa.rest;

import com.opensymphony.xwork2.Preparable;
import com.xunan.sitexa.action.PublishAction;
import com.xunan.sitexa.post.data.Category;
import com.xunan.sitexa.post.service.CategoryService;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.rest.DefaultHttpHeaders;
import org.apache.struts2.rest.HttpHeaders;

import javax.servlet.ServletException;
import java.io.IOException;

/**
 * User: xnpeng
 * Date: 2009-4-21
 * Time: 20:02:50
 */
public class PublishController extends PublishAction implements Preparable {
    private static String message_url = "/post/message/";
    private static String affair_url = "/post/affair/";
    private static String business_url = "/post/business/";
    private static String activity_url = "/post/activity/";
    private static String announce_url = "/post/announce/";
    private static String house_url = "/post/house/";
    private static String case_url = "/post/case/";
    private static String scenery_url = "/post/scenery/";
    private static String poll_url = "/post/poll/";

    public void prepare() {
        site = getHome();
    }

    public HttpHeaders index() throws IOException {
        String cateId = ServletActionContext.getRequest().getParameter("cateId");
        if (cateId != null && !cateId.equals(""))
            category = CategoryService.getCategory(cateId);

        if (category != null) {
            if (category.getCateId().equalsIgnoreCase(Category.MESSAGE)) {
                ServletActionContext.getResponse()
                        .sendRedirect(ServletActionContext.getRequest().getContextPath() + message_url + "new");
            } else if (category.getCateId().equalsIgnoreCase(Category.AFFAIR)) {
                ServletActionContext.getResponse()
                        .sendRedirect(ServletActionContext.getRequest().getContextPath() + affair_url + "new");
            } else if (category.getCateId().equalsIgnoreCase(Category.BUSINESS)) {
                ServletActionContext.getResponse()
                        .sendRedirect(ServletActionContext.getRequest().getContextPath() + business_url + "new");
            } else if (category.getCateId().equalsIgnoreCase(Category.ACTIVITY)) {
                ServletActionContext.getResponse()
                        .sendRedirect(ServletActionContext.getRequest().getContextPath() + activity_url + "new");
            } else if (category.getCateId().equalsIgnoreCase(Category.ANNOUNCE)) {
                ServletActionContext.getResponse()
                        .sendRedirect(ServletActionContext.getRequest().getContextPath() + announce_url + "new");
            } else if (category.getCateId().equalsIgnoreCase(Category.HOUSE)) {
                ServletActionContext.getResponse()
                        .sendRedirect(ServletActionContext.getRequest().getContextPath() + house_url + "new");
            } else if (category.getCateId().equalsIgnoreCase(Category.CASE)) {
                ServletActionContext.getResponse()
                        .sendRedirect(ServletActionContext.getRequest().getContextPath() + case_url + "new");
            } else if (category.getCateId().equalsIgnoreCase(Category.SCENERY)) {
                ServletActionContext.getResponse()
                        .sendRedirect(ServletActionContext.getRequest().getContextPath() + scenery_url + "new");
            } else if (category.getCateId().equalsIgnoreCase(Category.POLL)) {
                ServletActionContext.getResponse()
                        .sendRedirect(ServletActionContext.getRequest().getContextPath() + poll_url + "new");
            }
        }
        return new DefaultHttpHeaders("");
    }

    public HttpHeaders show() throws IOException, ServletException {

        String cateId = ServletActionContext.getRequest().getParameter("cateId");
        if (cateId != null && !cateId.equals(""))
            category = CategoryService.getCategory(cateId);

        String id = ServletActionContext.getRequest().getParameter("id");

        if (category != null && id != null) {
            if (category.getCateId().equalsIgnoreCase(Category.MESSAGE)) {
                ServletActionContext.getServletContext().getRequestDispatcher(message_url + id + "/show")
                        .forward(ServletActionContext.getRequest(), ServletActionContext.getResponse());
            } else if (category.getCateId().equalsIgnoreCase(Category.AFFAIR)) {
                ServletActionContext.getServletContext().getRequestDispatcher(affair_url + id + "/show")
                        .forward(ServletActionContext.getRequest(), ServletActionContext.getResponse());
            } else if (category.getCateId().equalsIgnoreCase(Category.BUSINESS)) {
                ServletActionContext.getServletContext().getRequestDispatcher(business_url + id + "/show")
                        .forward(ServletActionContext.getRequest(), ServletActionContext.getResponse());
            } else if (category.getCateId().equalsIgnoreCase(Category.ACTIVITY)) {
                ServletActionContext.getServletContext().getRequestDispatcher(activity_url + id + "/show")
                        .forward(ServletActionContext.getRequest(), ServletActionContext.getResponse());
            } else if (category.getCateId().equalsIgnoreCase(Category.ANNOUNCE)) {
                ServletActionContext.getServletContext().getRequestDispatcher(announce_url + id + "/show")
                        .forward(ServletActionContext.getRequest(), ServletActionContext.getResponse());
            } else if (category.getCateId().equalsIgnoreCase(Category.HOUSE)) {
                ServletActionContext.getServletContext().getRequestDispatcher(house_url + id + "/show")
                        .forward(ServletActionContext.getRequest(), ServletActionContext.getResponse());
            } else if (category.getCateId().equalsIgnoreCase(Category.CASE)) {
                ServletActionContext.getServletContext().getRequestDispatcher(case_url + id + "/show")
                        .forward(ServletActionContext.getRequest(), ServletActionContext.getResponse());
            } else if (category.getCateId().equalsIgnoreCase(Category.SCENERY)) {
                ServletActionContext.getServletContext().getRequestDispatcher(scenery_url + id + "/show")
                        .forward(ServletActionContext.getRequest(), ServletActionContext.getResponse());
            } else if (category.getCateId().equalsIgnoreCase(Category.POLL)) {
                ServletActionContext.getServletContext().getRequestDispatcher(poll_url + id + "/show")
                        .forward(ServletActionContext.getRequest(), ServletActionContext.getResponse());
            }
        }

        return new DefaultHttpHeaders("show").disableCaching();
    }

}





在2009-05-01,"Nils-Helge Garli Hegvik" <ni...@gmail.com> 写道:
>I'm not sure I understand your problem. Maybe you can give an example?
>I would be surprised if you couldn't handle this with regular Struts 2
>results.
>
>http://struts.apache.org/2.1.6/docs/result-types.html
>http://struts.apache.org/2.1.6/docs/result-configuration.html
>http://struts.apache.org/2.1.6/docs/parameters-in-configuration-results.html
>
>Nils-H
>
>
>2009/4/30 xnpeng <xn...@163.com>:
>> thanks for  your reply.
>> the result types cannot do my jobs in struts2+rest environment. in this environment, the "success","error",... did not work, only "index","show" ,... are the default result types. I can manage this.
>>
>> my situation is, I need to forward request to action conditionally,ie,depend on "category" in action class.
>>
>>
>>
>>
>> 在2009-04-29,"Nils-Helge Garli Hegvik" <ni...@gmail.com> 写道:
>>>Why do you need to do it manually with the request dispatcher? Can't
>>>you use any of the available result types?
>>>
>>>http://struts.apache.org/2.1.6/docs/result-types.html
>>>
>>>Nils-H
>>>
>>>2009/4/29 xnpeng <xn...@163.com>:
>>>> from:
>>>>
>>>> ServletActionContext.getServletContext().getRequestDispatcher("/post/message/"+id).forward(ServletActionContext.getRequest(),ServletActionContext.getResponse());
>>>>
>>>> I want to forward request to http://localhost:8080/post/message/3166,
>>>>
>>>> but it always throws out exception says requested resource not exist.
>>>>
>>>> when replace the string with "/index.jsp",it can work correctly.
>>>>
>>>> so, anyone who can help? I just want to forward request to an ACTION other than jsp file.
>>>>
>>>> thanks.
>>>
>>>---------------------------------------------------------------------
>>>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: Re: How to forward request in struts 2.1.6?

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
I'm not sure I understand your problem. Maybe you can give an example?
I would be surprised if you couldn't handle this with regular Struts 2
results.

http://struts.apache.org/2.1.6/docs/result-types.html
http://struts.apache.org/2.1.6/docs/result-configuration.html
http://struts.apache.org/2.1.6/docs/parameters-in-configuration-results.html

Nils-H


2009/4/30 xnpeng <xn...@163.com>:
> thanks for  your reply.
> the result types cannot do my jobs in struts2+rest environment. in this environment, the "success","error",... did not work, only "index","show" ,... are the default result types. I can manage this.
>
> my situation is, I need to forward request to action conditionally,ie,depend on "category" in action class.
>
>
>
>
> 在2009-04-29,"Nils-Helge Garli Hegvik" <ni...@gmail.com> 写道:
>>Why do you need to do it manually with the request dispatcher? Can't
>>you use any of the available result types?
>>
>>http://struts.apache.org/2.1.6/docs/result-types.html
>>
>>Nils-H
>>
>>2009/4/29 xnpeng <xn...@163.com>:
>>> from:
>>>
>>> ServletActionContext.getServletContext().getRequestDispatcher("/post/message/"+id).forward(ServletActionContext.getRequest(),ServletActionContext.getResponse());
>>>
>>> I want to forward request to http://localhost:8080/post/message/3166,
>>>
>>> but it always throws out exception says requested resource not exist.
>>>
>>> when replace the string with "/index.jsp",it can work correctly.
>>>
>>> so, anyone who can help? I just want to forward request to an ACTION other than jsp file.
>>>
>>> thanks.
>>
>>---------------------------------------------------------------------
>>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:Re: How to forward request in struts 2.1.6?

Posted by xnpeng <xn...@163.com>.
thanks for  your reply.
the result types cannot do my jobs in struts2+rest environment. in this environment, the "success","error",... did not work, only "index","show" ,... are the default result types. I can manage this.
 
my situation is, I need to forward request to action conditionally,ie,depend on "category" in action class.




在2009-04-29,"Nils-Helge Garli Hegvik" <ni...@gmail.com> 写道:
>Why do you need to do it manually with the request dispatcher? Can't
>you use any of the available result types?
>
>http://struts.apache.org/2.1.6/docs/result-types.html
>
>Nils-H
>
>2009/4/29 xnpeng <xn...@163.com>:
>> from:
>>
>> ServletActionContext.getServletContext().getRequestDispatcher("/post/message/"+id).forward(ServletActionContext.getRequest(),ServletActionContext.getResponse());
>>
>> I want to forward request to http://localhost:8080/post/message/3166,
>>
>> but it always throws out exception says requested resource not exist.
>>
>> when replace the string with "/index.jsp",it can work correctly.
>>
>> so, anyone who can help? I just want to forward request to an ACTION other than jsp file.
>>
>> thanks.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

Re: How to forward request in struts 2.1.6?

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
Why do you need to do it manually with the request dispatcher? Can't
you use any of the available result types?

http://struts.apache.org/2.1.6/docs/result-types.html

Nils-H

2009/4/29 xnpeng <xn...@163.com>:
> from:
>
> ServletActionContext.getServletContext().getRequestDispatcher("/post/message/"+id).forward(ServletActionContext.getRequest(),ServletActionContext.getResponse());
>
> I want to forward request to http://localhost:8080/post/message/3166,
>
> but it always throws out exception says requested resource not exist.
>
> when replace the string with "/index.jsp",it can work correctly.
>
> so, anyone who can help? I just want to forward request to an ACTION other than jsp file.
>
> thanks.

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


How to forward request in struts 2.1.6?

Posted by xnpeng <xn...@163.com>.
from:

ServletActionContext.getServletContext().getRequestDispatcher("/post/message/"+id).forward(ServletActionContext.getRequest(),ServletActionContext.getResponse());

I want to forward request to http://localhost:8080/post/message/3166,

but it always throws out exception says requested resource not exist.

when replace the string with "/index.jsp",it can work correctly.

so, anyone who can help? I just want to forward request to an ACTION other than jsp file.

thanks.

Re: Struts 2.1.6 - Alternative Template Engines - JSP

Posted by Musachy Barroso <mu...@gmail.com>.
The template engines just process certain types of templates(ftl, vm,
jsp, etc), but are not(directly) related to tags. The tags need to
output something, what you use to generate the output is up to you,
the struts tags use freemarker, but the javatemplates plugin uses
plain java, for example.

musachy

On Tue, Apr 28, 2009 at 3:06 AM, Kishan G. Chellap Paandy
<ki...@spanservices.com> wrote:
> Hi,
>
> I'm using Struts 2.1.6.
>
> I'm developing custom Struts 2.1.6 tags.
>
> I want to use org.apache.struts2.components.template.JspTemplateEngine.
>
> The framework supports three template engines, which can be controlled
> by the struts.ui.templateSuffix in struts.properties.
>
> If I set the above, does all the struts2 tags and the custom tags I'm
> developing will use the JSPTemplateEngine?
>
> I want to use JSPTemplateEngine only for some custom tags I'm developing
> and I will use FreemarkerTemplateEngine for some other custom tags. Is
> this possible?
>
> Thank you.
> Regards,
> Kishan.G
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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