开发者

is there way to put condition on an actionForward in struts config xml file

开发者 https://www.devze.com 2023-01-18 06:55 出处:网络
I\'m newbie, so please forgive bad terminology, etc... I want to only follow through on my forward when a condition is met, but I don\'t know how to incorporate that into my struts config xml. For exa

I'm newbie, so please forgive bad terminology, etc... I want to only follow through on my forward when a condition is met, but I don't know how to incorporate that into my struts config xml. For example, I have this:

<action path="somePath"
        type="myTypeClass" 
        parameter="method" 
        scope="request">
    <forward name="myForwardName1" path="myPage1.jsp"/>
    <forward开发者_StackOverflow中文版 name="myForwardName2" path="myPage2.jsp"/>
</action>

But I want this action to only work when a condition is true and throw an exception otherwise. Is there some syntax I can use to this. For example, I want none of the jsp pages to display if my condition is not met, but display some generic error message instead.


If I'm not mistaken, I don't think it's possible. Your Struts Action is where your business logic is implemented and decisions are made there to which ActionForward you want Struts to forward to.

Well, there are Struts-Validation that you can look at if you have predefined rules to link to a forward.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号