Oleksandr Papchenko
Oleksandr Papchenko

Reputation: 2221

How i can set value of attribute in jsp action dynamically?

I have action in my jsp page <jsp:include page = <%=(String)request.getAttribute("page")%> /> the page is request parameter that i have set previously in my servlet. But when i try to access my jsp page i get.

<jsp:include page = <%=(String)request.getAttribute("page")%> />

How to set page correctly ?

Upvotes: 0

Views: 1066

Answers (1)

Braj
Braj

Reputation: 46871

I suggest to avoid Scriplet instead use JSP Standard Tag Library and Expression language that is easy to user and less error prone.

the page is request parameter that i have set previously in my servlet.

Since as per you its request parameter then you can access it using JSTL and EL from parameter.

${param.page}

If its set a request attribute the access it a below:

${requestScope.page}

See Difference between getAttribute() and getParameter()

Upvotes: 1

Related Questions