How to pass Object using jsp:include param tag into another jsp

后端 未结 3 808
醉梦人生
醉梦人生 2021-02-07 03:59

I am trying to send DTO Object from one jsp to another jsp using jsp:include tag. But it is always treating it as String. I can\'t able to use DTO in my included jsp file.

3条回答
  •  我在风中等你
    2021-02-07 04:36

    You can not directly pass an Object using jsp:include param tag into another jsp.

    However, you can pass that attribute's NAME (as a string) using jsp:include param tag into another jsp, Then in the included jsp, you can get that attribute itself by its name from requestScope.

    in your main JSP:

      
         
             
         
    
    

    in attributeSubFeatureRemove.jsp:

    object's name = ${param.objName}
    object itself = ${requestScope[param.objName]}
    
    Just for an easier access:
    
    obj=${obj}
    

提交回复
热议问题