小编Kow*_*ser的帖子

EL语法中#{...}和$ {...}之间的区别是什么

你可以看到,我的问题很简单.

是什么区别#{...},并${...}在EL语法?

jsf el java-ee

11
推荐指数
2
解决办法
4295
查看次数

强制一个视图控制器ios的景观

我已经看过类似问题的几个答案,但答案都没有.我有一个应用程序,我需要一切portait除了我有一个照片查看器.在目标菜单的支持方向部分,我只有肖像.如何强制我的一个视图成为风景.它正从导航控制器推入堆栈,但我正在使用故事板来控制所有这些.

iphone orientation uinavigationcontroller viewcontroller ios

10
推荐指数
2
解决办法
9642
查看次数

如何获得与使用Java的JPA相同的数据库连接?

我正在使用Jasper Reports来生成报告.

我正在使用临时表生成报告,我需要JPA使用相同的连接,同时创建临时表我如何实现相同.

java database-connection jpa datasource jasper-reports

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

如何测试Spring Integration

我是Spring Integration的新手.我让ActiveMQ说'responseQ'.所以当消息到达'responseQ' - > painResponseChannel - > transformer - > processResponseChannel - > beanProcessing时.我有以下设置:

    <jms:message-driven-channel-adapter  extract-payload="true"
                                     channel="painResponseChannel"
                                     connection-factory="connectionFactory"
                                     destination-name="responseQ"/>

    <integration:channel id="painResponseChannel" />

    <integration-xml:unmarshalling-transformer
        id="defaultUnmarshaller"
        input-channel="painResponseChannel"
        output-channel="processResponseChannel"
        unmarshaller="marshaller"/>

    <integration:channel id="processResponseChannel" />

    <integration:service-activator
        input-channel="processResponseChannel"
        ref="processResponseActivator"/>

    <bean id="processResponseActivator" class="com.messaging.processor.PainResponseProcessor"/>


    <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
      <property name="classesToBeBound">
        <list>
            <value>com.domain.pain.Document</value>
        </list>
      </property>
    </bean>
Run Code Online (Sandbox Code Playgroud)

所以我的问题是我该如何测试结束?如何断言变压器的输出或断言通道上的什么?我尝试但失败了......希望有人可以提供帮助.

提前致谢.GM

我是这样测试的:在我的测试环境中创建了一个出站通道适配器,它使用testJmsQueue通道启动在activeMQ上发送消息.并且还为processResponseChannel - > testChannel创建了一个BRIDGE.我期待receive()方法能给我回馈一些东西.但我认为问题在于它太快了,当它到达receive()方法时,管道已经结束.

测试上下文如下所示:

<integration:bridge input-channel="processResponseChannel" output-channel="testChannel"/>

<jms:outbound-channel-adapter id="jmsOut" destination-name="responseQ" channel="testJmsQueue"/>

<integration:channel id="testJmsQueue"/>

<integration:channel id="testChannel">
    <integration:queue/>
</integration:channel>
Run Code Online (Sandbox Code Playgroud)

然后在单元测试中我有这个:

@ContextConfiguration(locations = "classpath*:PainResponseTest-context.xml")
@RunWith(SpringJUnit4ClassRunner.class)
public class PainResponseTest {

private String painResponseXML;

@Autowired
MessageChannel …
Run Code Online (Sandbox Code Playgroud)

spring spring-integration

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

私人班级单元测试

如何在java中进行单元测试私有(表示包可见性)?

我有一个包,这个包中只有一个类是公共的,其他类是私有的.如何覆盖其他单元测试分类?我想在休息罐中加入单元测试.

java junit unit-testing private

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

可以将aspectj添加到java.lang.String中

我已经阅读了一些关于aspectj的文章,我知道它可以增强类,这很有吸引力.我有一个非常愚蠢的问题,我找不到一个明确的答案:

Aspectj可以向java.lang.String添加方法吗?

或者类似的问题:如果我无法获得某些类的来源,我可以通过aspectj来增强它们吗?

java aspectj

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

分车场保留括号

我正在研究什么本质上是调车码算法,但是将中缀移动到前缀而不是 RPN 我试图保留括号,并且我有一段时间的恶魔。目前我的代码是

        String s = inFixList.get(i);
        Stack<Character> opStack = new Stack<Character>();
        Stack<Character> solutionStack = new Stack<Character>();
        String solution = "";

        for(char c : s.toCharArray())
        {
            if(Character.isLetter(c)||Character.isDigit(c))
            {
                solutionStack.push(c);
            }
            else if(c == '(')
            {
                opStack.push(c);
                solutionStack.push(')');
            }
            else if(c == ')')
            {                   
                while(opStack.peek() != '(')
                {
                    solutionStack.push(opStack.pop());
                    solutionStack.push('(');
                }
                opStack.pop();
            }
            else if (!Character.isSpaceChar(c))
            {
                if(opStack.isEmpty())
                {
                    opStack.push(c);
                }                       
                else if(opStack.peek()!='(' &&(OPERATORS.indexOf(c) < OPERATORS.indexOf(opStack.peek())))
                {
                    opStack.push(c);
                }
                else if(!opStack.isEmpty()&&(opStack.peek()!='('))
                {
                    solutionStack.push(opStack.pop());
                    solutionStack.push('(');
                    opStack.push(c);

                }
                else
                {
                    opStack.push(c);
                }

            } …
Run Code Online (Sandbox Code Playgroud)

java string algorithm shunting-yard

5
推荐指数
0
解决办法
1194
查看次数

如何删除日历中的特定事件

我想要做的是只删除我在日历中保存的内容而不是我已经在日历中显示的所有内容..因为我使用以下代码..但它将删除日历的所有内容..谁也可以告诉我如何防止这种情况..

Uri CALENDAR_URI = Uri.parse("content://calendar/events");
ContentResolver cr = getContentResolver();
cr.delete(CALENDAR_URI, null, null); // Delete all



ContentValues values = new ContentValues();
values.put("calendar_id", 1);
values.put("title", this.title);
values.put("allDay", this.allDay);
values.put("dtstart", this.dtstart.toMillis(false));
values.put("dtend", this.dtend.toMillis(false));
values.put("description", this.description);
values.put("eventLocation", this.eventLocation);
values.put("visibility", this.visibility);
values.put("hasAlarm", this.hasAlarm);

cr.insert(CALENDAR_URI, values);
Run Code Online (Sandbox Code Playgroud)

所以我想要的只是删除我提出的那个条目......

删除该事件

Uri EVENTS_URI = Uri.parse("content://com.android.calendar/" + "events");

ContentResolver cr = c.getContentResolver();
deleteEvent(cr, EVENTS_URI, 1);

private void deleteEvent(ContentResolver resolver, Uri eventsUri, int calendarId) {
        Cursor cursor;     
        cursor = resolver.query(eventsUri, new String[]{ "_id" },     "calendar_id=" + calendarId, null, null);
        while(cursor.moveToNext()) { …
Run Code Online (Sandbox Code Playgroud)

java android

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

如何在Kohana PHP Framework中的url路由中显示用户名?

我正在研究Kohana PHP框架.

我想在我的网址中显示"用户名"而不是控制器名称.

例如,

username = james然后如何显示

HTTP://本地主机:3000 /詹姆斯

代替

http:// localhost:3000/scrapbook/index => ... localhost:3000 /剪贴簿

(控制器:剪贴簿,动作:索引)

在网址中.

我的引导程序文件包含此类URL的条目.如果我手动编写..//localhost:3000/james,它会将我带到请求的页面.

//Viewing a user's profile or account details - user/action
Route::set('profile', '(<username>(/<action>(/<id>)))',
    array(
        'username'   => '([A-Za-z0-9\-]+)'))
    ->defaults(array(
        'controller' => 'scrapbook',
        'action'     => 'index'));
Run Code Online (Sandbox Code Playgroud)

我想要的是如果我手动登录并转到剪贴簿,我的网址应该显示'用户名'而不是控制器的名称.如果有人能指导我,我将不胜感激.谢谢

php routing kohana kohana-3

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

在JavaFX中使用JavaScript调用java.可能吗?

我正在使用WebEngineWebView来自JavaFX.现在我想使用内部运行的javascript来执行Java WebEngine.

我的问题是,是否有可能这样做,如果是的话有任何提示.

我想做类似下面的事情

<script type="text/javascript">
  function runSampleJava() {
    var number = new java.lang.Integer(1234);
    var random = new java.util.Random();
    java.lang.System.out.println(random.nextInt());
  }
</script>
Run Code Online (Sandbox Code Playgroud)

现在如果我调用runSampleJava()内部WebEngine它将执行该代码.


需要注意的要点

  • 这不是关于Rhinojava的JavaScript引擎
  • 我知道可以注入java对象,例如:JSObject window = (JSObject) webEngine.executeScript("window");等等.但这不是我要找的.

javascript java javafx

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