我在Liferay门户的一些CSS文件中有CSS代码.
什么是html>表示什么?什么时候应该使用?
.lfr-dockbar-pinned {
.dockbar {
left: 0;
position: fixed;
right: 0;
top: 0;
}
.pin-dockbar img {
background-image: url(../images/dockbar/unpin.png);
}
}
html > .lfr-dockbar-pinned {
padding-top: 3.45em;
}
Run Code Online (Sandbox Code Playgroud) 我使用的是JSF 1.2
我有一个应该可点击的图像.以下是我编码的方式,
<h:commandLink value="" action="#{myBean.myMethod}>
<h:graphicImage value="image-location-in-webserver" />
</h:commandLink>
Run Code Online (Sandbox Code Playgroud)
使用h:commandLink
是因为点击这个图像我必须做一些业务验证,因此我需要在bean中调用一个方法.
我的豆是一个session
范围.由于其他一些问题,我不能满足要求范围.
我尝试javax.faces.STATE_SAVING_METHOD
将其设置为客户端而不是服务器.
即使这样,当我的页面被渲染时,图像也没有被渲染,因为当在web开发人员中查看时,jsessionid会被添加到url中.
http:/myDomail/static-files/images/myImage.jpg;jsessionid=77F2A5D24CF1D5C3C4882778BC521263.node1
Run Code Online (Sandbox Code Playgroud)
如果未附加jsessionid,则会渲染我的图像.
我怎样才能做到这一点?
我使用以下代码设置Cookie,
document.cookie = name+"="+value+ ";expires="+"domain=xyz.com;path=/";
我的服务器中设置的会话过期时间为15分钟。如果客户端空闲15分钟,则15分钟后,会话将被破坏。这会破坏我的Cookie中设置的值吗?
我的意思是,是否设置了document.cookie
cookie过期与服务器中设置的cookie过期有关?
我有以下代码,
<div id="nav">
<a href="#" >Tab1</a>
<a href="#" >Tab2</a>
<a href="#" >Tab3</a>
<a href="#" >Tab4</a>
<a href="#" >Tab5</a>
<a href="#" >Tab6</a>
<a href="#" >Tab7</a>
<a href="#" class="tab8Class">Tab8</a>
<a href="#" >Tab9</a>
</div>
#nav a {
float: left;
color: #004761;
font-size: 12px;
font-weight: bold;
text-decoration: none;
padding: 9px 5px 9px 13px;
background-colour: white;
}
.tab8Class {
float: left;
color: #004761;
font-size: 12px;
font-weight: bold;
text-decoration: none;
padding: 9px 5px 9px 13px;
background-color: lightgray;
}
Run Code Online (Sandbox Code Playgroud)
我想background-colour
为Tab8 应用不同的东西.所以,对于Tab8,我在a href
标签中添加了一个额外的类.
但是,即使对于Tab8, …
我有一个Session
扩展的监听器PortalSessionListener
。我有sessionCreated(HttpSessionEvent httpSessionEvent)
和sessionDestroyed(HttpSessionEvent httpSessionEvent)
方法
当我的Session
监听器失效时(根据我在 web.xml 中的配置,15 分钟后),我的监听器将被调用并Session
失效。
Cookie
在我的监听器中,我想在注销用户之前清除值。所以,我想要Request
和Response
对象,以便我可以清除 Cookie 值并将其设置为Response
.
Request / Response
但是,如何在侦听器中获取具有 的对象HttpSessionEvent
?
我尝试了下面的代码。sessionDestroyed
但是,当调用我的方法或任何其他阶段时,这不会被调用。
public void requestInitialized(ServletRequestEvent servletRequestEvent)
{
log.debug("Entered into requestInitialized method");
HttpServletRequest request = (HttpServletRequest) servletRequestEvent.getServletRequest();
log.debug("Request object created is :" +request);
}
Run Code Online (Sandbox Code Playgroud)
有人建议实现 aFilter
适合此要求(用于获取Request
对象)。如何将其应用到我的场景中?
我写了一个Filter
下面是代码.
public void doFilter(ServletRequest request, ServletResponse response,FilterChain chain)
throws IOException, ServletException {
HttpServletRequest srequest = (HttpServletRequest) request;
HttpServletResponse sresponse = (HttpServletResponse) response;
String url = srequest.getRequestURI();
if(url.contains("//What patterns to be checked here?"))
{
//Invalidate the Session
//Redirect to error page
}
Run Code Online (Sandbox Code Playgroud)
我正在阅读形成的网址,并希望避免XSS
攻击.因此,我想在URL中检查可能表明它可能导致XSS
攻击的任何模式.
我可以获得我可以在这里查看的所有模式的综合列表吗?例如,
url.contains("<script>");
Run Code Online (Sandbox Code Playgroud) css ×2
jsf-1.2 ×2
session ×2
cookies ×1
html ×1
httprequest ×1
httpresponse ×1
jsf ×1
security ×1
xss ×1