I am trying to change the look of the jsp/servlet pages dynamically based on the device from which the request comes. i have done the part of how to identify the devices from which the request arises. but stuck at the part where i should change the css sheet.

is this ok?

out.println("<link>...</link>");

is there any other way i could do this?

you mean you want to include links to different css files in the resulting html stream depending on some parameters?
What you're doing now is indeed the correct way to do that using servlets alone.
Were you using jsp, you'd set the string to be used as the uri to the css in the request object and in the jsp read that out and use jstl to insert it into the proper place in the html.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.