小编Dan*_*ani的帖子

Primefaces在点击按钮时显示动画

我在primefaces中有以下按钮和面板:

<p:commandButton value="Submit"
    ajax="true" actionListener="#{myBean.search}" update="resultPanel" oncomplete="panelwv.show();">
</p:commandButton>

<p:panel widgetVar="panelwv" visible="false" closable="true"
    toggleable="true" id="resultPanel">
Run Code Online (Sandbox Code Playgroud)

我想在myBean.search执行时,屏幕上会出现一个动画.有帮助吗?谢谢!!

primefaces

7
推荐指数
1
解决办法
2万
查看次数

Spring Security:如何用标志强制https?

使用Spring安全性,我配置了我的Web应用程序的部分,需要通过带security:intercept-url标记的https进行保护.

例如:

<security:intercept-url pattern="/**/*secure*" requires-channel="https"/>
<security:intercept-url pattern="/**" requires-channel="http" />    
Run Code Online (Sandbox Code Playgroud)

这样,在文件名中包含"安全"的所有请求或在最低级别包含"安全"的目录获取https,其余的将获得http.

有没有办法使用旗帜来制作Spring force https?在"?"之后,我无法获得任何工作.一个网址.

  • http://domain/abc?secure=true => https
  • http://domain/abc => http

那么Spring将透明地重定向每个请求要http://domain/abc?secure=truehttps://domain/abc?secure=true.

有没有办法实现这一目标?示例中的第一个模式实现了在"?"之前发生"安全"的结果,但我正在寻找一个解决方案/模式,在"?"之后有一个标志.只要.

https spring-security

6
推荐指数
1
解决办法
1万
查看次数

Liferay portlet中没有编辑模式

我正在关注Liferay In Action书.我正处于将编辑模式添加到portlet的部分.portlet已成功部署,我已添加了portlet,现在该书说要单击portlet中的扳手并单击Preferences链接,但我没有Preferences链接.查看工作正常.

这是我的portlet.xml:

<?xml version="1.0"?>

<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0">
<portlet>
    <portlet-name>hello-john</portlet-name>
    <display-name>Hello John</display-name>
    <portlet-class>com.liferaytest.portlet.HelloJohnPortlet</portlet-class>
    <init-param>
        <name>view-jsp</name>
        <value>/view.jsp</value>
    </init-param>
    <init-param>
        <name>edit-jsp</name>
        <value>/edit.jsp</value>
    </init-param>
    <expiration-cache>0</expiration-cache>
    <supports>
        <mime-type>text/html</mime-type>
        <portlet-mode>view</portlet-mode>
        <portlet-mode>edit</portlet-mode>
    </supports>
    <portlet-info>
        <title>Hello John</title>
        <short-title>Hello John</short-title>
        <keywords>Hello John</keywords>
    </portlet-info>
    <security-role-ref>
        <role-name>administrator</role-name>
    </security-role-ref>
    <security-role-ref>
        <role-name>guest</role-name>
    </security-role-ref>
    <security-role-ref>
        <role-name>power-user</role-name>
    </security-role-ref>
    <security-role-ref>
        <role-name>user</role-name>
    </security-role-ref>
</portlet>
Run Code Online (Sandbox Code Playgroud)

我的edit.jsp:

<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>

<jsp:useBean class="java.lang.String" id="addNameURL" scope="request" />

<portlet:defineObjects />

<form 
id ="<portlet:namespace />helloForm" 
action="<%= addNameURL %>" 
method="post">
<table>
    <tr>
        <td>Name:</td> …
Run Code Online (Sandbox Code Playgroud)

java portlet liferay

6
推荐指数
1
解决办法
4269
查看次数

无法在Liferay Portlet JSP页面中包含css和JS文件

我已经下载了一个Jquery Image Slider源代码,想要与我的JSP文件进行整合

这是我的Folder Struture

在此输入图像描述

这是我包括他们的方式

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<link type="text/css" href="/css/jquery.ui.theme.css" rel="stylesheet" />
<link type="text/css" href="/css/jquery.ui.core.css" rel="stylesheet" />
<link type="text/css" href="/css/jquery.ui.slider.css" rel="stylesheet" />
<link rel="stylesheet" href="/css/style.css" type="text/css" media="screen"/>
Run Code Online (Sandbox Code Playgroud)

我在服务器控制台中得到了这个404

20:50:04,625 WARN [404_jsp:109] /css/jquery.ui.theme.css
20:50:04,640 WARN [404_jsp:109] /css/jquery.ui.core.css
20:50:04,640 WARN [404_jsp:109] /css/jquery.ui.slider.css
20:50:04,656 WARN [404_jsp:109] /css/style.css
20:50:04,671 WARN [404_jsp:109] /js/cufon-yui.js
20:50:04,671 WARN [404_jsp:109] /js/GreyscaleBasic.font.js
20:50:04,687 WARN [404_jsp:109] /js/jquery.easing.1.3.js
Run Code Online (Sandbox Code Playgroud)

javascript portlet liferay

6
推荐指数
2
解决办法
2万
查看次数

PDF格式的数字签名

我正在尝试使用项目对PDF文件进行数字签名.

当它执行st.Close(); 我得到臭名昭着的"对象引用未设置为对象的实例".

我不知道为什么会发生这种情况,st是一个对象的实例,它在上面使用.这个异常发生在.Close()中,因为我没有源代码,我只能猜测为什么......

我只能这样说:

  1. 原始PDF正在成功阅读.
  2. 正在生成一个空的pdf(我猜.Close()将写入该文件).
  3. 我的证书正在加载,但我不确定这是正确的方法.

这是我如何加载证书:

private void processCert(X509Certificate2 card)
{
    X509CertificateParser cp = new org.bouncycastle.x509.X509CertificateParser(card.RawData);
    chain = new org.bouncycastle.x509.X509Certificate[] { cp.ReadCertificate() };
}
Run Code Online (Sandbox Code Playgroud)

这就是我试图签署PDF的方式.

public string Sign(string SigReason, string SigContact, string SigLocation, bool visible)
{
    string bugLog ="";
    try
    {
        PdfReader reader = new PdfReader(this.inputPDF);

        //Activate MultiSignatures
        PdfStamper st = PdfStamper.CreateSignature(reader, new FileStream(this.outputPDF, FileMode.Create, FileAccess.Write), '\0', null, true);

        FileStream(this.outputPDF, FileMode.Create, FileAccess.Write), '\0'); 

        st.MoreInfo = this.metadata.getMetaData();

        st.XmpMetadata = this.metadata.getStreamedMetaData();

        PdfSignatureAppearance sap = st.SignatureAppearance;

        sap.SetCrypto(this.myCert.Akp, this.myCert.Chain, …
Run Code Online (Sandbox Code Playgroud)

pdf digital-certificate digital-signature

5
推荐指数
1
解决办法
4285
查看次数

如何确定使用Spring Security访问URL所需的角色?

我正在使用Spring Security来保护webapp.URL的安全性如下:

<security:http entry-point-ref="authenticationEntryPoint">
  <security:intercept-url pattern="/" access="ROLE_ANONYMOUS" />
  <security:intercept-url pattern="/assets/**/*" access="ROLE_ANONYMOUS" />
  ...
  <security:intercept-url pattern="/**" access="ROLE_USER" />
  <security:anonymous granted-authority="ROLE_ANONYMOUS" />
</security:http>
Run Code Online (Sandbox Code Playgroud)

我有一个过滤器,在某些情况下需要将用户重定向到特殊页面.但是,该页面需要资产目录中的图像和CSS文件,遗憾的是,这些文件也会被重定向到该特殊页面.我不希望过滤器手动检查每个URL模式,因为我的实际URL配置要长得多,而且我还想允许其他页面.

有没有办法从过滤器中确定给定页面需要哪些角色?如果不需要ROLE_ANONYMOUS,我可以选择不重定向.

java spring spring-mvc spring-security

5
推荐指数
1
解决办法
3058
查看次数

Spring Security自定义用户授权表

我想在我的网络应用程序中使用Spring Security 3.1.我已经开始关注这个特定的教程了.

我正在使用此处使用的技术,其中身份验证提供程序是数据源

<authentication-manager>
    <authentication-provider>
        <jdbc-user-service data-source-ref="dataSource"

           users-by-username-query="
              select email,password 
              from usr where email=?" 

           authorities-by-username-query="
              select u.email, ur.authority from usr u, usr_roles ur 
              where u.usr_id = ur.usr_id and u.email =?  " 

        />
    </authentication-provider>
</authentication-manager>
Run Code Online (Sandbox Code Playgroud)

因此,如果您发现我使用该电子邮件作为我的用户名,并且我没有启用的列.

这似乎不起作用.

我的登录表单看起来像

<form name="f" action="<c:url value="j_spring_security_check" />" method="POST">
    <table>
        <tr>
        <td>User:</td>
        <td><input type="text" name="j_username" value=""></td>
        </tr>
        <tr>
        <td>Password:</td>
        <td><input type="password" name="j_password" />
        </td>
        </tr>
        <tr>
        <td colspan="2">
                <input name="submit" type="submit" value="submit" />
            </td>
        </tr>
        <tr>
        <td colspan="2">
                <input name="reset" type="reset" />
        </td> …
Run Code Online (Sandbox Code Playgroud)

spring-security

5
推荐指数
1
解决办法
2309
查看次数

p:fileUpload在哪里保存我的文件?

我的页面上有ap:fileUpload函数,每次上传文件时,我都无法在web.xml文件中指定的文件夹中找到它.

我已将以下罐子添加到我的库中:primefaces-3.2.jar commons-io-2.3.jar commons-fileupload-1.2.2.jar

这是我的web.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
     version="3.0">

    <filter> 
        <filter-name>PrimeFaces FileUpload Filter</filter-name> 
        <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class> 
    <init-param> 
        <param-name>uploadDirectory</param-name> 
        <param-value>C:\Users\SomeUser\Documents\NetBeansProjects\System\Upload\</param-value> 
    </init-param> 
    <init-param> 
        <param-name>thresholdSize</param-name> 
        <param-value>1000000</param-value> 
    </init-param> 
    </filter>

    <filter-mapping>
        <filter-name>PrimeFaces FileUpload Filter</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>

    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>

    <error-page>
        <error-code>404</error-code>
        <location>/404.jsf</location>
    </error-page>

    <context-param>  
    <param-name>primefaces.THEME</param-name>  
    <param-value>aristo</param-value>  
</context-param>  

</web-app>
Run Code Online (Sandbox Code Playgroud)

我使用以下:PrimeFaces 3.2,JSF 2.0和GlassFish 3.1.1

任何帮助将不胜感激.谢谢

jsf file-upload glassfish primefaces

5
推荐指数
1
解决办法
9651
查看次数

Primefaces 3.4 dataexporter不导出值p:cellEditor

我正在使用Primefaces 3.4并尝试使用单元格内部编辑导出数据表.它似乎不起作用.

我做了以下事情:

修改了org.primefaces.component.export.Exporter第143行并添加了这个:

else if (component instanceof CellEditor) { // Handle in-cell editable datatables
    return exportValue(context, ((CellEditor) component).getFacet("output"));
}
Run Code Online (Sandbox Code Playgroud)

这会导致顶部的额外行以及带有数据的实际单元格右侧的额外列.使用Excel文件可以,因为它们不是"可见"但PDF看起来很糟糕.

  1. 有没有办法让PF 3.4支持这个而不改变源代码?
  2. 如果上述答案是否定的,我是否可以在没有附加行/列的情况下生成PDF?

java jsf primefaces

5
推荐指数
1
解决办法
8076
查看次数

pdfbox:...在此字体的编码中不可用

pdfbox 2.0.2在从先前阅读的文档(https://www.dropbox.com/s/ttxiv0dq3abh5kj/Test.pdf?dl=0)的元素中编写pdf文档时出现问题。一切正常,除非当我调用showTextPDPageContentStream时,我以前曾用它设置字体out.setFont(textState.getFont(), textState.getFontSize())(请参阅信息日志),并且字体是ComicSansMS或ArialBlack。textState是先前读取文档的状态(从其克隆)。用Helvetica或Times-Roman编写文本效果很好。

INFORMATION: set font PDTrueTypeFont RXNQOL+ComicSansMS,Bold/18.0 embedded    
SEVERE: error writing <w>U+0077 is not available in this font's encoding: built-in (TTF)
Run Code Online (Sandbox Code Playgroud)

我想这个问题可能是由于字体名称中缺少连字符或空格引起的,但不知道如何解决此问题。

这是完整的代码

INFORMATION: set font PDTrueTypeFont RXNQOL+ComicSansMS,Bold/18.0 embedded    
SEVERE: error writing <w>U+0077 is not available in this font's encoding: built-in (TTF)
Run Code Online (Sandbox Code Playgroud)

有什么建议么?

谢谢,于尔根

pdf fonts pdfbox

5
推荐指数
1
解决办法
5345
查看次数