Topic
1 reply Latest Post - ‏2012-03-27T17:57:06Z by kendel911
kendel911
kendel911
170 Posts
ACCEPTED ANSWER

Pinned topic stylesheet in .faces

‏2012-03-26T14:51:59Z |
Open a new window:

var url = "<%=renderResponse.encodeURL(renderRequest.getContextPath() + "/newWin.faces")%>";
myWindow = window.open(url,"myNewWindow","scrollbars=yes,toolbar=yes,resizable=yes,menubar=yes");

When I tried to include a style sheet in this newWin.jsp and it gave me the error " RenderResponse cannot be resolved to a type"

<%@page import="javax.faces.context.FacesContext"%>

<%
RenderResponse renderResponse = (RenderResponse) request.getAttribute("javax.portlet.response");
RenderRequest renderRequest = (RenderResponse) request.getAttribute("javax.portlet.request");
%>

<link rel="stylesheet" type="text/css" title="Style"
href='<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/theme/stylesheet.css") %>'>
Does any one know how to include a stylesheet in this case? Thanks.
Updated on 2012-03-27T17:57:06Z at 2012-03-27T17:57:06Z by kendel911
  • kendel911
    kendel911
    170 Posts
    ACCEPTED ANSWER

    Re: stylesheet in .faces

    ‏2012-03-27T17:57:06Z  in response to kendel911
    <%@page import="javax.portlet.RenderRequest"%>
    <%@page import="javax.portlet.RenderResponse"%>

    <%
    RenderResponse renderResponse = (RenderResponse) request.getAttribute("javax.portlet.response");
    RenderRequest renderRequest = (RenderRequest) request.getAttribute("javax.portlet.request");
    %>

    <link rel="stylesheet" type="text/css" title="Style"
    href='<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/theme/stylesheet.css") %>'>

    Error 500: java.lang.NullPointerException

    3/27/12 13:53:09:537 EDT 0000003f servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper doDestroy SRVE0253I: TestProjectEAR [/NewWin.jsp]: Destroy successful.
    3/27/12 13:53:09:553 EDT 0000003f servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: TestProjectEAR [/NewWin.jsp]: Initialization successful.
    3/27/12 13:53:09:553 EDT 0000003f servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet /NewWin.jsp in application TestProjectEAR. Exception created : java.lang.NullPointerException
    at com.ibm._jsp._NewWin._jspService(_NewWin.java:105)
    at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:104)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
    at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:259)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:354)
    at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:415)
    at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:494)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:162)
    at com.ibm.faces.portlet.PortletViewHandlerImpl.renderView(PortletViewHandlerImpl.java:79)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:114)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:104)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)