开发者

Multiple c:imports with Stripes is causing problems

开发者 https://www.devze.com 2023-03-15 23:45 出处:网络
I\'m having a problem when I call the same Stripes action with multiple c:import tags in the same jsp.When I use the first c:import, I use a few c:params with it.These get bound to the corresponding f

I'm having a problem when I call the same Stripes action with multiple c:import tags in the same jsp. When I use the first c:import, I use a few c:params with it. These get bound to the corresponding fields in the action. But then when I use the next c:import, the fields are already set from the first c:import, which is not what I want. I want to be able to import an action several times, and each time it sho开发者_如何学编程uld only use the values I pass in with the c:param tags.

The only solution I could think of is to call a method before binding and validation takes place, that sets all the fields to null. Is that a bad idea? What's the best way to handle this?

    <c:import url="/widget/House.action">
        <c:param name="dogNam" value="Muffin" />
        <c:param name="catName" value="Junior" />
    </c:import>

    <c:import url="/widget/House.action">
        <c:param name="dogNam" value="Rocky" />
    </c:import>

In this example catName is getting set to "Junior" both the first and second time I use the c:import.


The c:import fires an http request to your Java application server and from what you describe the second c:import still seems to add the catName parameters to the request, you might want to try this:

<c:import url="/widget/House.action">
    <c:param name="dogNam" value="Rocky" />
    <c:param name="catNam" value="" />
</c:import>
0

精彩评论

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