flyingfox
flyingfox

Reputation: 13506

How to simulate jsp:param in SpringMVC

I have a jsp file with use jsp:include to include another jsp

    <jsp:include page="/WEB-INF/jsp/bug/bugQueryFilter.jsp">
        <jsp:param value="bugFilterClick()" name="submitFun"/>
        <jsp:param value="collapseOne" name="collDIVName"/>
        <jsp:param value="bugSearchVO" name="parameterName"/>
    </jsp:include>

In the bugQueryFilter.jsp I use ${param.collDIVName} to get the parameter.

Now I face a problem,I need to return bugQueryFilter.jsp in SpringMVC directly,but I do not know how to pass the parameter to it

public String changeFilter(HttpServletRequest request){
   request.setAttribute("collDIVName","collapseOne");//in this way ${param.collDIVName} will not get the parameter
   return "bugQueryFilter.jsp";
}

Now I want to know how the simulate jsp:param to pass parameter to the bugQueryFilter.jsp page directly?

Note:due to some reason,I can not change ${param.collDIVName} to ${collDIVName} when access parameter

I know I can create a new jsp page,and invoke jsp:include in the new jsp page,then return the new jsp page,however I think this is not an elegant way.

Can anyone help me,please?

Upvotes: 0

Views: 33

Answers (1)

Halko Karr-Sajtarevic
Halko Karr-Sajtarevic

Reputation: 2268

Did you try returning a ModelAndView?

e.g.

public ModelAndView changeFilter(HttpServletRequest request) {
    return new ModelAndView("redirect:bugQueryFilter.jsp?collDIVName=collapseOne");
}

Upvotes: 1

Related Questions