小编Lan*_*erX的帖子

Spring MVC,表单动作中的子文件夹

我有问题,如何在动作属性中创建uri.我必须使用子文件夹作为"用户","管理员"因为我使用Spring Security.

<form:form action="/user/reservationTour.html" method="post" commandName="bookTourForm">
Run Code Online (Sandbox Code Playgroud)

结果,没有项目名称http:// localhost:8080/user/reservationTour.html

<form:form action="user/reservationTour.html" method="post" commandName="bookTourForm">
Run Code Online (Sandbox Code Playgroud)

结果,链接中的2x用户http:// localhost:8080/ProjectContextTitle/user/user/reservationTour.html

<form:form action="<c:url value="/user/reservationTour.html" />" method="post" commandName="bookTourForm">
Run Code Online (Sandbox Code Playgroud)

结果,例外

org.apache.jasper.JasperException: /jsp/user/reservationTourPage.jsp(7,33) Unterminated &lt;form:form tag
Run Code Online (Sandbox Code Playgroud)

这很好,但肯定不是很好的解决方案

<form:form action="/ProjectContextName/user/reservationTour.html" method="post" commandName="bookTourForm">
Run Code Online (Sandbox Code Playgroud)

forms action spring-mvc

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

由于master中的奇怪变化,无法推分支

我在分公司工作,让我们说出来mybranch.我不修改master.我想推动改变,origin/feature/mybranch但我有一些问题.奇怪的是我之前做过几次并没有任何问题.

$ git branch
develop
* feature/mybranch
master


$ git push
To http://......
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'http://....'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. If you did not intend to push that branch, you may want to
hint: specify branches to push or set the 'push.default' configuration variable
hint: to 'simple', 'current' or 'upstream' to push …
Run Code Online (Sandbox Code Playgroud)

git push

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

找到com.google.gwt.core.ext.typeinfo.JClassType接口,但是预期了类

我正在尝试使用带有gwt-maven-plugin的Maven运行遗留项目.我有以下错误

找到com.google.gwt.core.ext.typeinfo.JClassType接口,但是预期了类

它与GWT 2.4.0连接.关于降级GWT或重新编译gwtp有一些答案,但我不明白.

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>2.4.0</version>
    <executions>
        <execution>
            <goals>
                <goal>compile</goal>
                <goal>i18n</goal>
            </goals>
        </execution>
    </executions>

    <configuration>
        <runTarget>someTarget.html</runTarget>
        <hostedWebapp>${webappDir}</hostedWebapp>
        <i18nMessagesBundle>org.I18nMsg</i18nMessagesBundle>
    </configuration>
</plugin>

<pluginManagement>
    <plugins>
        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>
                    org.codehaus.mojo
                </groupId>
                <artifactId>
                gwt-maven-plugin
                </artifactId>
                <versionRange>
                [2.4.0,)
                </versionRange>
                <goals>
                    <goal>i18n</goal>
                </goals>
            </pluginExecutionFilter>
            <action>
                <execute></execute>
            </action>
            </pluginExecution>
        </pluginExecutions>
....
Run Code Online (Sandbox Code Playgroud)

错误:

[INFO]    Scanning for additional dependencies: jar:file:/C:/Users/xxx/.m2/repository/com/extjs/gxt/2.2.0/gxt-2.2.0.jar!/com/extjs/gxt/ui/client/core/El.java
[INFO]       Computing all possible rebind results for 'com.extjs.gxt.ui.client.core.impl.ComputedStyleImpl'
[INFO]          Rebinding com.extjs.gxt.ui.client.core.impl.ComputedStyleImpl
[INFO]             Could not find an exact match rule. Using 'closest' rule <replace-with class='com.extjs.gxt.ui.client.core.impl.ComputedStyleImplIE'/> based on fall back …
Run Code Online (Sandbox Code Playgroud)

java gwt maven-plugin maven

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

拆分字符串,将元素放入List中,并带有两个可能的分隔符

我想在两个可能的分隔符"/"或"//"上将字符串拆分为List.但更重要的是,分隔符也应该放在同一个列表中.我不能用Guava中的Splitter或java.util.Scanner来做这个.

Scanner s = new Scanner(str);
s.useDelimiter("//|/");
while (s.hasNext()) {
    System.out.println(s.delimiter());
    System.out.println(s.next());
}
Run Code Online (Sandbox Code Playgroud)

s.delimiter()回报//|/.我想得到///.

你知道其他任何一个可以做到这一点的图书馆吗?

我写了一些代码,它可以工作,但它不是很好的解决方案:

public static ArrayList<String> processString(String s) {
    ArrayList<String> stringList = new ArrayList<String>();
    String word = "";
    for (int i = 0; i < s.length(); i++) {
        if (s.charAt(i) == '/' && i < s.length() && s.charAt(i + 1) == '/') {
            if (!word.equals(""))
                stringList.add(word);
            stringList.add("//");
            word = "";
            i++;
        } else if (s.charAt(i) == '/') {
            if (!word.equals("")) …
Run Code Online (Sandbox Code Playgroud)

java string split splitter delimiter

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

如何避免if语句和调用多个构造函数

我想问一下如何处理多个构造函数.

if(a != null && b != null)
    return new QueryProducer(query, a, b);
else if(a != null)
    return new QueryProducer(query, a);
else if(b != null)
    return new QueryProducer(query, b);
else return new QueryProducer(query);
Run Code Online (Sandbox Code Playgroud)

我想避免复杂的if else块.在这种情况下,可伸缩性也不是很好.

java oop if-statement

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

标签 统计

java ×3

action ×1

delimiter ×1

forms ×1

git ×1

gwt ×1

if-statement ×1

maven ×1

maven-plugin ×1

oop ×1

push ×1

split ×1

splitter ×1

spring-mvc ×1

string ×1