Add native css and js

Hello i need add native css and js script into vaadin application:

i wondering something like that:

@WebServlet(name = "Sample Application",
initParams = {
    @WebInitParam(name = "application",
    value = "com.example.noxml.EntryPoint")
urlPatterns = {"/*"})
public class EE6ApplicationServlet extends ApplicationServlet {

    protected void writeAjaxPageHtmlHeader(BufferedWriter page, String title, String themeUri) throws IOException {
        super.writeAjaxPageHtmlHeader(page, title, themeUri);
        page.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"[b]
[/b]\" />");//add link into header 


So my example Css-style page :

<%@ page language="java" contentType="text/css; charset=UTF-8" pageEncoding="UTF-8" %>

	width: ${width}
	font-size: ${fontsize}

and my controller who send file when url = /css

@WebServlet(name = "Sample",

urlPatterns = {"/css"})
public class ShopCssServlet extends ApplicationServlet

	private static final long serialVersionUID = 1L;
	private static final String CSS_PAGE = "/WEB-INF/mystyle.jsp";
	public  String width ;
	public  String fontsize;
	public void init() throws ServletException 
		fontsize = 12+""; // get value from database but for example initialize default value
		width = 34 + "";
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
    		throws ServletException, IOException 
    	super.doGet(req, resp);
    	req.setAttribute("fontsize", fontsize);
    	req.setAttribute("width", width);
    	getServletContext().getRequestDispatcher(CSS_PAGE).forward(req, resp);

But its not working i need tool that i can set css styles using databases values … so its complicated . I use this trick before when i write in jsp … and its working very well but in vaadin i cant configure it …

i thing its not working because when i click in firefox ‘view page source’ i havent got this link in head ?? so how can i add info in header using vaadin ??

It should work like that, override writeAjaxPageHtmlHeader() in the servlet class and append the text in the page. Then it should show in the HTML source after you load the page. You could debug it a bit to make sure that it’s called and that there’s no some redeployment problem.

Perhaps the
CSSInject add-on
would work in your case without so much trickery to get the CSS loaded?