小编Jav*_*ons的帖子

用于登录的简单易懂的spring应用程序

我刚刚开始学习并且今天开始学习,我正在寻找一个简单的登录应用程序,它将解释应用程序的流程.

当我用Google搜索时,我真的找不到一个是:

  1. http://viralpatel.net/blogs/tutorial-spring-3-mvc-introduction-spring-mvc-framework/
  2. http://www.tutorialspoint.com/spring/spring_mvc_hello_world_example.htm

等等..

请不要低估或关闭这个问题,因为这不仅有助于我,也有助于许多人.

谢谢和最诚挚的问候

java spring spring-mvc spring-security

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

spring security中的配置问题

我有spring安全应用程序,以下是我的security-contex.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/security
           http://www.springframework.org/schema/security/spring-security-3.0.3.xsd">

    <http auto-config='true'>
        <intercept-url pattern='/login*' filters='none' />
        <intercept-url pattern='/**' access='ROLE_USER' />
        <form-login login-page='/login' default-target-url='/home'
            always-use-default-target='true' />
    </http>
    <authentication-manager>
        <authentication-provider>
            <user-service>
                <user name="anto" password="anto" authorities="ROLE_USER, ROLE_ADMIN" />
                <user name="raj" password="raj" authorities="ROLE_USER" />
            </user-service>
        </authentication-provider>
    </authentication-manager>

</beans:beans>
Run Code Online (Sandbox Code Playgroud)

我得到这个例外:

配置问题:您无法在Spring Security 3.0中使用spring-security-2.0.xsd架构.请将架构声明更新为3.0架构.

我能理解这个问题,但不知道在哪里改变.

我希望登录和注销表单自动生成.

EDIT : 

My pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.anto</groupId>
    <artifactId>simpleauthentication</artifactId>
    <name>SimpleAuthentication</name>
    <packaging>war</packaging>
    <version>1.0.0-BUILD-SNAPSHOT</version>
    <properties>
        <java-version>1.6</java-version>
        <org.springframework-version>3.1.1.RELEASE</org.springframework-version>
        <org.aspectj-version>1.6.10</org.aspectj-version>
        <org.slf4j-version>1.6.6</org.slf4j-version>
        <spring-security.version>3.0.2.RELEASE</spring-security.version>
    </properties>
    <dependencies>
        <!-- Spring …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc spring-security

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

什么是AbstractTestNGSpringContextTests

我有一个TestNG类,如下所示:

public class WebAPITestCase extends AbstractTestNGSpringContextTests{.....}
Run Code Online (Sandbox Code Playgroud)

我试图理解这意味着什么extends AbstractTestNGSpringContextTests.

它是如何工作的以及它的用途是什么?

java testng spring unit-testing spring-mvc

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

退出HttpClient会话

如何退出HttpClient会话?

我使用以下代码使用Apache HttpClient登录应用程序

public HttpClient loginToHexgen(String username, String password) {
        HttpClient client = new DefaultHttpClient();

        // send post url to login to  hexgen
        HttpPost post = new HttpPost("http://localhost:8080/j_spring_security_check");

        try {
            // set the user name and password
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
            nameValuePairs.add(new BasicNameValuePair("j_username", username));
            nameValuePairs.add(new BasicNameValuePair("j_password", password));

            post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            HttpResponse response = client.execute(post);

            HttpEntity entity = response.getEntity();

            if (entity != null) {
                post.abort();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return client;
    }
Run Code Online (Sandbox Code Playgroud)

如下:

HttpClient client = new …
Run Code Online (Sandbox Code Playgroud)

java apache-httpclient-4.x

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

如何为链接创建onclick

我有一个div我会在运行时动态设置值的值,如果有值比我启用或创建的链接要有onclick方法,我将在其中调用javascript方法。

如何在jquery或中执行此操作javascript

我将值设置div为如下所示,

document.getElementById('attachmentName').innerHTML=projectInforamtionMap.Cim_AttachmentNames;
Run Code Online (Sandbox Code Playgroud)

这个div:

<tr>
  <td align="left"><div id="attachmentName"> </div></td>
</tr>
Run Code Online (Sandbox Code Playgroud)

请帮助我查找并修复。

最好的祝福

javascript jquery onclick href

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

在javascript中定位提示弹出窗口

我有一个像下面这样的javascript提示,我想带上屏幕的提示中心.如何使用javascript做到这一点?

function showUpdate() {     
    var x;    
    var name=prompt("Please enter your name","");

    if ( name != null ) {
      x="Hello " + name + "! How are you today?";
      alert("Input : " + name );          
    }

}
Run Code Online (Sandbox Code Playgroud)

这就是我称之为:

<a onclick = "showUpdate() " style="vertical-align: middle;" class="parent" href=""><span>5. Missed P/U Comments</span></a>
Run Code Online (Sandbox Code Playgroud)

它工作找到excepts提示转到左角IE和中心Firefox 但我需要相同的解决方案,以在两个浏览器中工作.

javascript

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

Select2的行为与未为Select2 <select2-id>定义的Uncaught查询功能非常不同

我按以下方式加载select2的值.

声明类型

var  AdjustmentType = Backbone.Model.extend({
            url : Hexgen.getContextPath("/referencedata/adjustmenttype")
    });
Run Code Online (Sandbox Code Playgroud)

为Type创建实例

var adjustmentTypes = new AdjustmentType();
Run Code Online (Sandbox Code Playgroud)

将值加载到select2框

adjustmentTypes.fetch({
                    success : function() {
                        for(var count in adjustmentTypes.attributes) {
                            $("#adjustment-type").append("<option>" + adjustmentTypes.attributes[count] + "</option>");
                        }
                    }
                });  
                $("#adjustment-type").select2({
                     placeholder: "Select Adjustment Type",
                     allowClear: true
                 });
Run Code Online (Sandbox Code Playgroud)

我的HTML代码

<div class="span4">
        <div>ADJUSTMENT TYPE</div>
        <select id="adjustment-type" tabindex="5" style="width:200px;">
            <option value=""></option>
        </select>
    </div>
Run Code Online (Sandbox Code Playgroud)

当我为第一个加载它时它没有给出任何异常但是如果我Refreshnavigate to different URL我得到以下异常:

Uncaught query function not defined for Select2 adjustment-type
Run Code Online (Sandbox Code Playgroud)

html5 bootstrapping backbone.js jquery-select2 marionette

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

如何根据操作系统更改文件路径

我有一个类,它读取特定位置的可用列表,

以下是我的代码,

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class ExceptionInFileHandling {

   @SuppressWarnings({ "rawtypes", "unchecked" })
   public static void GetDirectory(String a_Path, List a_files, List a_folders) throws IOException {
       try {
           File l_Directory = new File(a_Path);
           File[] l_files = l_Directory.listFiles();

           for (int c = 0; c < l_files.length; c++) {
               if (l_files[c].isDirectory()) {
                   a_folders.add(l_files[c].getName());
               } else {
                   a_files.add(l_files[c].getName());
               }
           }
       } catch (Exception ex){
           ex.printStackTrace();
       }

   }
   @SuppressWarnings("rawtypes")
   public static void main(String args[]) throws IOException {

       String filesLocation = …
Run Code Online (Sandbox Code Playgroud)

java linux windows file

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

如何将Java POJO转换为JSON字符串?

我有一个POJO为我设定值,pojo是:

public class CreateRequisitionRO extends AbstractPortfolioSpecificRO {

    private static final long serialVersionUID = 2418929142185068821L;

    private BigDecimal transSrlNo;
    private String transCode;
    private InflowOutflow inflowOutflow;

public BigDecimal getTransSrlNo() {
        return transSrlNo;
    }

    public void setTransSrlNo(BigDecimal transSrlNo) {
        this.transSrlNo = transSrlNo;
    }

    public InflowOutflow getInflowOutflow() {
        return inflowOutflow;
    }

    public void setInflowOutflow(InflowOutflow inflowOutflow) {
        this.inflowOutflow = inflowOutflow;
    }
    public String getTransCode() {
        return transCode;
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我设置值的方式:

CreateRequisitionRO[] request = new CreateRequisitionRO[1];
    request[0].setTransSrlNo(new BigDecimal(1));
    request[0].setTransCode("BUY");
    request[0].setInflowOutflow(InflowOutflow.I);

now i would like to convert/serialize the …
Run Code Online (Sandbox Code Playgroud)

java json conventions

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

如果我没有为Maven依赖项指定版本,会发生什么?

我在项目中看到maven依赖指定如下,

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
        </dependency>
Run Code Online (Sandbox Code Playgroud)

在依赖项中没有定义版本,所以如果我不提供版本名称以及为什么如上所述给出会发生什么.

有人会解释原因吗.

maven

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