小编Med*_*n92的帖子

设置单元格样式不起作用

我正在使用apache poi和XLSX文件.我使用xssf类动态创建电子表格.我想在for循环中设置单元格的样式,但它似乎不起作用......这是我的代码:

for(int i=1;i<=gc.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);i++,gc.add(GregorianCalendar.DATE, 1),righe++){
        Row r = foglio.createRow(righe);

        if(getDayOfWeek(gc)== 6 || getDayOfWeek(gc) == 7){
            XSSFCellStyle cs1 = wb.createCellStyle();
            cs1.setFillBackgroundColor(IndexedColors.YELLOW.getIndex());
            cs1.setFillPattern(CellStyle.SOLID_FOREGROUND);
            XSSFFont f = wb.createFont();
            f.setBold(true);
            f.setColor(IndexedColors.RED.getIndex());
            cs1.setFont(f);
            Cell c1 = r.createCell(0);
                 c1.setCellValue(cost.getGiorni().get(getDayOfWeek(gc)-1).getNomeGiorno());
                 c1.setCellStyle(cs1);
            Cell c2 = r.createCell(1);
                 c2.setCellValue(i);
                 c2.setCellStyle(cs1);
        }               
        r.createCell(0).setCellValue(cost.getGiorni().get(getDayOfWeek(gc)-1).getNomeGiorno());
        r.createCell(1).setCellValue(i);
Run Code Online (Sandbox Code Playgroud)

...这只是代码的一部分......我无法理解为什么不工作.似乎像cellstyle被忽略或者被淹没....

任何线索?

apache-poi xssf

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

停止石英调试日志记录 log4j

我一直试图关闭烦人的石英调试日志记录。我正在使用 log4j 作为日志记录框架,并且我已经尝试将此行添加到 lg4j 属性文件中

"log4j.logger.org.quartz=ERROR"
Run Code Online (Sandbox Code Playgroud)

我仍然收到大量这些调试日志消息

13:35:44.680 [MyScheduler_QuartzSchedulerThread] DEBUG o.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers
Run Code Online (Sandbox Code Playgroud)

我怎样才能关闭这个功能?

编辑。我已将我的配置移至 xml 文件...但仍然遇到同样烦人的问题

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration>
    <appender name="console" class="org.apache.log4j.ConsoleAppender">
        <param name="Target" value="System.out" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{ABSOLUTE} %5p %c{1}:%L - %m%n" />
        </layout>
    </appender>

    <logger name="org.quartz" >
        <level value="ERROR" />
        <appender-ref ref="console" />
    </logger>

    <logger name="org.hibernate">
        <level value="ERROR" />
        <appender-ref ref="console" />
    </logger>

    <logger name="com.mchange.v2.c3p0" additivity="false">
        <level value="ERROR" />
        <appender-ref ref="console" />
    </logger>

    <root>
        <priority value="ERROR" …
Run Code Online (Sandbox Code Playgroud)

java logging log4j quartz-scheduler

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

如何使用c:out来逃避JSTL中的字符

<c:out>在我的项目中使用JSTL 来支持javascript代码,我有一个来自servlet的字符串,这样"2\'000;11\'222;10\'333"用javascript我想将它拆分以获得分隔值,如2'000;11'222;10'333....但是当我使用<c:out>标签时这就"\'"成了"\&#039;"搞乱分裂功能....

有没有办法告诉JSTL不要逃避字符?

stringaCompleta += 'Gennaio;<c:out value="${valori.value}" />';
Run Code Online (Sandbox Code Playgroud)

javascript java jstl

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

如何制作websphere 8.5使用mojarra而不是myfaces

我在eclipse中运行了一个JSF2(Richfaces 4.1.0)项目.我正在尝试使用mojarra jsf实现(2.2.0)在WAS 8.5上运行它.然后lib提供maven但服务器似乎覆盖它们,因为在控制台中我可以读取Myfaces已被加载.

我想知道为什么这样做?如何让项目使用mojarra而不使用共享库是管理控制台?

这是maven相关的代码部分:

    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.2.0</version>
    </dependency>

    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.2.0</version>
    </dependency>

    <dependency>
        <groupId>javax.faces</groupId>
        <artifactId>javax.faces-api</artifactId>
        <version>2.2</version>
    </dependency>

    <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.faces</artifactId>
        <version>2.2.0</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

提前致谢

richfaces maven-3 websphere-8

3
推荐指数
1
解决办法
6376
查看次数

在春天从模型和视图下载文件

我正在尝试创建一个用户可以下载某个.log文件的页面.这是代码:

if(action.equalsIgnoreCase("download")){
       String file = (String)request.getParameter("file");
       response.setHeader("Content-Disposition",
       "attachment;filename="+file+"");
       response.setContentType("text/plain");

       File down_file = new File("log/"+file);

       FileInputStream fileIn = new FileInputStream(down_file);
       ServletOutputStream out = response.getOutputStream();

       byte[] outputByte = new byte[4096];
       //copy binary contect to output stream
       while(fileIn.read(outputByte, 0, 4096) != -1)
       {
        out.write(outputByte, 0, 4096);
       }
       fileIn.close();
       out.flush();
       out.close();

       return null;
}
Run Code Online (Sandbox Code Playgroud)

我在哪里做错了?当我点击下载按钮时它正确地要求我保存文件,但它总是一个0字节的文件...

java spring spring-mvc download

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