问题列表 - 第32038页

当属性名称本身是动态变量时,如何获取bean属性的值

我正在尝试编写一个自定义JSPX标记,该标记从给定列表中的每个对象读取给定bean属性的值,该属性的名称作为JSP属性传递给标记.标签看起来像这样:

<jsp:root xmlns:c="http://java.sun.com/jsp/jstl/core"
        xmlns:jsp="http://java.sun.com/JSP/Page"
        version="2.0">
    <jsp:output omit-xml-declaration="yes"/>

    <jsp:directive.attribute name="items" type="java.lang.Iterable"
        required="true" description="The items whose properties are to be read"
        rtexprvalue="true"/>
    <jsp:directive.attribute name="propertyName" type="java.lang.String"
        required="true" description="The name of the bean property to read"
        rtexprvalue="true"/>

    <c:forEach items="${items}" var="item">
        <!-- This is the bit that doesn't work -->
        <jsp:getProperty name="item" property="${propertyName}" />
    </c:forEach>

</jsp:root>
Run Code Online (Sandbox Code Playgroud)

问题是标签的property属性jsp:getProperty似乎不接受表达式,只接受文字值.所以这可行,但对我没用(因为我不知道属性名称,直到运行时):

<jsp:getProperty name="item" property="firstName" />
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

org.apache.jasper.JasperException: org.apache.jasper.JasperException:
PWC6054: Cannot find any information on property '${propertyName}' in
a bean of type 'com.example.FooBar'
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助.

jsp jspx properties el javabeans

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

使用php返回特定的http状态代码

有没有办法让PHP脚本返回特定的http状态代码,而不是依靠apache来做到这一点?

php http

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

测试周围的非零元素

这是以下部分:

2)其他问题:

在得到非零邻居的平均值之后,我还想测试邻居元素是否等于,小于或大于非零的平均值.如果它大于或等于'1'或者否则为'0'.

注意:如果邻居在两个或更多中心的半径内,则采用最小的中心平均值进行测试.

    0    12     9     
    4  **9**    15     
   11    19     0 
Run Code Online (Sandbox Code Playgroud)

中间的'9'在12,15和19中心的半径范围内,因此取最小平均值[9.000,9.000,8.000] = 8.000

例如,当半径= 1米或1个元素时.

new_x =

     0         0          0          0         0
     0         0     **9.0000**    9.0000      0
     0      4.0000     9.0000    **9.0000**    0
     0    **8.3333** **8.0000**      0         0
     0      2.0000     4.0000      8.0000      0
     0      4.0000     5.0000      8.0000      0
     0         0          0          0         0
Run Code Online (Sandbox Code Playgroud)

Test_x =

     0         0           0           0         0
     0         0       **9.0000**      1         0
     0         0           1       **9.0000**    0
     0    **8.3333**   **8.0000**      0         0
     0         0 …
Run Code Online (Sandbox Code Playgroud)

matlab matrix

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

使用Exchange Web服务(EWS)托管API获取当前电子邮件的ItemId的下一封电子邮件的ItemId

我需要在C#中编写一个方法,使用Exchange Web服务(EWS)托管API从邮箱中读取电子邮件并给出当前电子邮件的ItemId/UniqueId,在收件箱中返回下一封电子邮件的ItemId/UniqueId.当前的电子邮件.

此外,由于各种原因,我要求该方法是一个静态无状态方法,也就是说,它不能依赖于在方法调用之间持续存在的任何成员/全局变量.因此,我不能简单地存储对FindItemsResults对象的实例的引用,并在每次调用该方法时移动到下一个Item.

我尝试使用以下代码实现该方法(仅简化示例,无错误检查):

using Microsoft.Exchange.WebServices;
using Microsoft.Exchange.WebServices.Data;
...
...
public string GetNextEmailId(string currentItemId)
{
    // set up Exchange Web Service connection
    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
    service.AutodiscoverUrl("example.user@contoso.com");
    // create SearchFilter to find next email after current email
    ItemId itemId = new ItemId(currentItemId);
    SearchFilter sfNextEmail = new SearchFilter.IsGreaterThan(EmailMessageSchema.Id, itemId);
    // find next email in inbox
    ItemView itemView = new ItemView(1);
    itemView.OrderBy.Add(EmailMessageSchema.DateTimeReceived, SortDirection.Ascending);
    FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, sfNextEmail, itemView);
    // return unique ID of next email
    return findResults.Items[0].Id.UniqueId;
}
Run Code Online (Sandbox Code Playgroud)

但是,当我运行此方法时,它会从service.FindItems行抛出以下异常:

System.ArgumentException:"验证失败.参数名称:searchFilter" …

.net managed exchangewebservices ews-managed-api

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

服务器推送与客户端拉取代理服务器拓扑

我需要创建一个包含2个组件的系统:

  • 处理和存储数据的单个服务器.它还定期向代理发送更新

  • 安装在远程端点的多个代理程序.这些数据收集(通常但不总是)长时间运行的数据,这些数据需要到达服务器

我正在使用C#.NET,理想情况下我想使用符合标准的通信方法(即可以在理论上与Java一起使用的方法,因为我们将来也可能使用Java代理).有没有Web服务的替代品?我有什么选择?

我看到它的方式我有3个选项使用Web服务,并做了以下观察:

  • 客户拉
    • 代理不需要开放端口,因为它像客户端一样
    • 需要轮询服务器以获取更新
  • 服务器推送
    • 在代理程序中打开端口,因为它充当服务器
    • 服务器必须轮询代理以获取结果
  • 混合动力
    • Open port at the agent, as it acts like both a client and a server
    • No polling; server pushes out updates when required, client sends results when they are available

The 'hybrid' (where agents are both client and server seems the obvious choice - but this application will typically be installed in enterprise and government environments, and I'm concerned they may have an issue with opening a port …

.net c# architecture networking

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

One CSS file vs multiple for different pages

I have a site where all the pages have the same header and footer, but vary in between on content. I'd estimate that 30% of the CSS is common to all the pages, with 70% varying.

What are the relative advantages and disadvantage of using one CSS file vs multiple for different pages?

css

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

In pthread, how to reliably pass signal to another thread?

I'm trying to write a simple thread pool program in pthread. However, it seems that pthread_cond_signal doesn't block, which creates a problem. For example, let's say I have a "producer-consumer" program:

pthread_cond_t my_cond = PTHREAD_COND_INITIALIZER;
pthread_mutex_t my_cond_m = PTHREAD_MUTEX_INITIALIZER;

void * liberator(void * arg)
{
    // XXX make sure he is ready to be freed
    sleep(1);

    pthread_mutex_lock(&my_cond_m);
    pthread_cond_signal(&my_cond);
    pthread_mutex_unlock(&my_cond_m);

    return NULL;
}

int main()
{
    pthread_t t1;
    pthread_create(&t1, NULL, liberator, NULL);

    // XXX Don't take too long to get ready. …
Run Code Online (Sandbox Code Playgroud)

concurrency multithreading pthreads

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

杀死并重新启动适合某种模式的多个进程

我正在尝试编写一个shell脚本,它会杀死所有正在运行的匹配特定模式的进程,然后重新启动它们.我可以用以下方式显示进程:

ps -ef|grep ws_sched_600.sh|grep -v grep|sort -k 10
Run Code Online (Sandbox Code Playgroud)

其中列出了相关流程:

user 2220258       1   0 16:53:12      -  0:01 /bin/ksh /../../../../../ws_sched_600.sh EDW02_env
user 5562418       1   0 16:54:55      -  0:01 /bin/ksh /../../../../../ws_sched_600.sh EDW03_env
user 2916598       1   0 16:55:00      -  0:01 /bin/ksh /../../../../../ws_sched_600.sh EDW04_env
Run Code Online (Sandbox Code Playgroud)

但我不太确定如何通过进程ID来杀死?

unix shell scripting kill

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

Tkinter Text小部件中的超链接?

我正在设计我当前软件项目的一部分,并希望使用超链接而不是Buttons.我真的不想使用Text小部件,但是当我搜索主题时,这就是我能找到的.无论如何,我找到了一个这样的例子,但不断收到这个错误:

TclError: bitmap "blue" not defined
Run Code Online (Sandbox Code Playgroud)

当我添加这行代码时(使用IDLE)

hyperlink = tkHyperlinkManager.HyperlinkManager(text)
Run Code Online (Sandbox Code Playgroud)

该模块的代码位于此处,脚本的代码位于此处

有人有主意吗?

提出问题的部分说foreground="blue",在Tkinter中被称为颜色,不是吗?

python windows tkinter hyperlink

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

如何将参数设置为BIRT报告中的值列表?

我有一个DataSet,其查询如下:

select s.name, w.week_ending, w.sales 
from store s, weekly_sales_summary w 
where s.id=w.store_id and s.id = ?
Run Code Online (Sandbox Code Playgroud)

我想修改查询以允许我指定商店ID列表,例如:

select s.name, w.week_ending, w.sales 
from store s, weekly_sales_summary w 
where s.id=w.store_id and s.id IN (?)
Run Code Online (Sandbox Code Playgroud)

我如何在BIRT中完成此任务?我需要指定什么样的参数?

birt

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