问题列表 - 第21457页

如何在JSTL中获取随机数?

我想得到类似JSTL中生成的下一个代码

<c:choose>
    <c:when test="${random number is even}">
        <div class="redlogo">
    </c:when>
    <c:otherwise>
        <div class="greenlogo">
    </c:otherwise>
</c:choose>
Run Code Online (Sandbox Code Playgroud)

jsp jstl el

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

C++私有真的是私有的吗?

private在C++中尝试访问说明符的有效性.开始:

接口:

// class_A.h

class A
{
public:
    void printX();
private:
    void actualPrintX();
    int x;
};
Run Code Online (Sandbox Code Playgroud)

执行:

// class_A.cpp
void A::printX()
{
    actualPrintX();
}

void A::actualPrintX()
{
    std::cout << x:
}
Run Code Online (Sandbox Code Playgroud)

我将其构建到静态库(.a/.lib)中.我们现在有一个class_A.h和classA.a(或classA.lib)对.我编辑了class_A.h并从中删除了private:它.

现在在另一个classTester.cpp中:

#include "class_A.h"    // the newly edited header

int main()
{
    A a;

    a.x = 12;           // both G++ and VC++ allowed this!
    a.printX();         // allowed, as expected
    a.actualPrintX();   // allowed by G++, VC++ gave a unresolved linker error

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

我知道在篡改了一个库的标题之后所有的赌注都没有了(我的意思是,系统完整性等等)虽然方法很黑,但这真的允许吗?有办法阻止这个吗?或者我在这里做错了什么?

c++ encapsulation private data-integrity access-specifier

18
推荐指数
5
解决办法
1444
查看次数

WCF ServiceHost已经有5种行为

我正在创建一个ServiceFactory来控制通过IIS 7暴露的服务的内部化.

但是我对ServiceHost的行为感到惊讶.虽然我有0个服务配置文件,但无论我在哪里初始化一个新的ServiceHost,如下所示:

var host = new ServiceHost(typeof(MyService), baseAddresses);
Run Code Online (Sandbox Code Playgroud)

接下来,我只想在构建处于调试模式时添加一些行为:

#if DEBUG
host.Description.Behaviors.Add(new ServiceDebugBehavior());
#endif
Run Code Online (Sandbox Code Playgroud)

但是,此代码失败导致ServiceDebugBehavior已应用!尽管我没有配置文件,并且没有应用于服务类的属性,但主机已经具有此行为并且还应用了5个!

这是预期的行为吗?如果我想在发布版本上禁用ServiceDebugBehavior怎么办?

提前致谢,

c# service wcf

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

字符串数组中的NULL

如何删除字符串数组中的Null值

像{, - 2,3, - 4,+ 5,,66 ...}

我需要删除其间的空值并重新调整数组大小

  1. 我不想使用列表

  2. 我不想创建一个新的数组

如果可以使用简单的代码,请告诉我.谢谢.

c# character-arrays

3
推荐指数
2
解决办法
9702
查看次数

当usercontrol变得可见时执行javascript

加载页面时,我有一个usercontrol,可见= false.然后,它变得可见=真.我想在代码隐藏中将此usercontrol设置为visible = true时执行一些javascript.我找到的唯一解决方案是使用ScriptManager.RegisterStartupScript

usercontrol的代码背后.但我不喜欢在codeBehind中编写我的javascript.

usercontrol中的这个jQuery不起作用:$(document).ready(function(){alert('test');});

用户控件进入更新面板.

asp.net jquery

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

我得到了这个例外:未解决的编译问题

我从项目中删除了jar(pdfbox,bouncycastle等)并将它们移动到另一个文件夹但我将它们包含在构建路径中后得到此异常...

在第一行eclipse显示此错误(构造函数PDFParser(InputStream)引用缺少类型InputStream)-altought FileInputStream是从InputStream扩展的 - 我不知道为什么?

FileInputStream in = new FileInputStream(path);
PDFParser parser = new PDFParser(in);
PDFTextStripper textStripper = new PDFTextStripper();
parser.parse();
String text = textStripper.getText(new PDDocument(parser.getDocument()));
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?**

Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problems: 
 The constructor PDFParser(InputStream) refers to the missing type InputStream
 The constructor PDFTextStripper() refers to the missing type IOException
 The method parse() from the type PDFParser refers to the missing type IOException
 The method getText(PDDocument) from the type PDFTextStripper refers to the missing type …
Run Code Online (Sandbox Code Playgroud)

java

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

如何修复IE7浮动组合

我有一个field_wrapper类div,它包含3个子divs field_label,field_input和field_error

我需要将field_label,field_input并排放在前两个下面的field_error中.

请看下面的css代码,知道我是如何实现这一点的,我的问题是它在IE7中不起作用.清除两者应用于field_error不起作用.

即使经过谷歌搜索很长一段时间,我也找不到合适的方法来解决这个问题而不添加HTML标记.请提示css技巧或任何其他方法以避免额外的标记代码

.field_wrapper
{
 clear:both;
}

.field_label
{
 float:left;
 width:40%;
}
.field_input
{
 float:left;
 width:40%;
}
.field_error
{
 clear: both;
 color:#FF0000;
 float: right;
 text-align:left;
 width: 60%;
}

<form method="post" action="http://localhost/locations/add">
 <div class="field_wrapper">
  <div class="field_label">
   <label for="location_add_name">Name</label>
  </div>
  <div class="field_input">
   <input type="text" id="location_add_name" value="" name="name">
  </div>
  <div class="field_error">
   <p>The Name field is required.</p>
  </div>
 </div>
 <div class="field_wrapper">
  <div class="field_label">
   Address
  </div>
  <div class="field_input">
   <textarea id="location_add_address" rows="12" cols="90" name="address"></textarea>
  </div>
  <div class="field_error">
  </div>
 </div>
 <div class="form_submit">
  <input type="submit" value="Add" …
Run Code Online (Sandbox Code Playgroud)

css clear css-float internet-explorer-7

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

maven tomcat插件与$ catalina_home/lib中的mysql驱动程序

我想在tomcat中使用容器管理的数据源(通过context.xml).相应的jar文件需要进入$ catalina_home/lib,否则tomcat找不到它.(不在webapp/WEB-INF/lib中,因为它由Web服务器管理,而不是由应用程序本身管理)

问题是:我正在使用maven和maven-tomcat-plugin,所以我没有$ catalina_home(一切都在我的.m2 -repository中分发).

所以问题是:如何将mysql驱动程序jar添加到tomcat服务器的类路径中(mvn tomcat:run)?

非常感谢,

gerolf.

mysql plugins tomcat maven-2 jar

8
推荐指数
1
解决办法
3115
查看次数

登录设备到文件

如何将设备上的日志记录重定向到文件?

我的应用程序挂在设备上,但在模拟器上工作得很好 - 我希望看到我的设备上没有sdk及其工具的日志记录.

java logging android

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

如何使用Delphi 7中的PageProducer发送电子邮件?

我正在使用Delphi 7制作应用程序,我需要使用PageProducer组件发送电子邮件,以便以HTML格式制作.此时,目标是以两种格式发送电子邮件:text/plain并且text/html,但是真的知道如何以一种格式发送它:或者text/plain或者text/html.那么,如何使用PageProducer两种格式发送电子邮件:普通和HTML?

我需要这个,因为有些webmail服务器不接受HTML电子邮件.

delphi

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