bharathi
bharathi

Reputation: 6271

How to pass a servlet context parameter in gsp page

Can anyone know how to pass the servlet context value in gsp page.

I need to pass the servlet context value customcss to the resource link.

If I print the ${application.customcss} in my gsp page I am getting the value as main.css.

But when i try to pass the same to file link then its not taking the ${application.customcss} value.

<link rel="stylesheet" href="${resource(dir: 'css', file:'${application.customcss}')}" type="text/css"> 

In my page the link is get not get created properly.Its directly taking the ${application.customcss} as a file.

  <link rel="stylesheet" href="/SAM-1.0/css/${application.customcss}" type="text/css">

Upvotes: 0

Views: 219

Answers (1)

Igor Artamonov
Igor Artamonov

Reputation: 35961

try:

<link rel="stylesheet" href="${resource(dir: 'css', file: application.customcss)}" type="text/css"> 

${resource(... is already Groovy code, you don't need to use another block of ${..} inside

Upvotes: 1

Related Questions