标签: spring-webflow

Spring MVC与Spring Web Flow有何不同?

我必须使用Java构建在线电子商务网站.因为我想使用像jQuery/prototupe/moottols这样的AJAX库,有人告诉我去基于请求/操作的框架,因为我来自web开发背景.

所以我开始学习Spring.我做过Spring DI和AOP.

有人可以指导我,为了达到我使用spring和JQuery(与html页面相同)开发电子商务网站的目标,我还有什么需要学习的东西

我应该去Spring MVC或网络流程还是相同的.我很迷惑.请帮我

另外,我是否需要了解Spring MVC或Web流的servlet和JSP?有人告诉我不要做旧的servlet/JSP事情.

或者我必须学习春季MVC.我可以花一周的时间来获得基础知识,但我不知道该怎么做

java spring spring-mvc spring-webflow

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

Spring/Webflow验证问题

验证问题

当方法"注册"时我会运行验证

在webflow中:...

<transition on="registered" to="registeredAction" bind="true" validate="true" />
Run Code Online (Sandbox Code Playgroud)

...

我的模型看起来像这样:

class User {
private String name;
private String surname;
...
private List <address> addresses;
...
public void validateRegistered (ValidationContext context) {
Context.getMessageContext MessageContext messages = ();

if (name == null) {
messages.addMessage (new MessageBuilder (.) error (). source ("name".) code (MessageCodes.Error.REQUIRED.) build ());
}
}
Run Code Online (Sandbox Code Playgroud)

在Address类中

Class Address {

private String street;
private String city;

public void validateRegistered (ValidationContext context) {
Context.getMessageContext MessageContext messages = ();

if (street == …
Run Code Online (Sandbox Code Playgroud)

java validation spring spring-webflow

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

Spring Flow:从Main WebFlow和Subflow之间来回传递对象

我从主流中调用子流.我已经能够ShareHolderProfile从MainFlow 将对象传递给SubFlow.但是,我不确定这个相同的对象是否没有被传递回MainFlow,或者我在JSP中没有正确访问它.我是这样做的.

MainFlow.xml

<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
start-state="retriveAccount">

    <var name="acctProfile" class="com.abc.xyz.account.ShareHolderProfile"/>

    <view-state id="retriveAccount" view="AccountView">
        <transition on="Success" to="createAccountSubFlow"/>
    </view-state>

    <subflow-state id="createAccountSubFlow" subflow="createAccountSubFlow">
        <input name="acctProfile" value="acctProfile"/>     
        <transition on="finish" to="showAlternateRoute"/>
    </subflow-state>    

    <view-state id="showAlternateRoute" view="showAlternateView" model="acctProfile">
        <on-entry>
            <evaluate someExpression result="viewScope.SomeValue"/>
        </on-entry> 
        <transition on="viewAction" to="accountDetails"/>       
    </view-state>
Run Code Online (Sandbox Code Playgroud)

SubFlow.xml

<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow  
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
start-state="showAccount">

    <input name="acctProfile" />    

    <view-state id="showAccount" view="randomView" model="acctProfile">
        <on-entry>
            <evaluate expression="SomExpression"/>  
        </on-entry>  
        <transition on="SomeEvent" to="NextState"/>
    </view-state>

    <view-state id="NextState" view="SomeRandomView" model="acctProfile">
         <on-entry>
             <evaluate expression="controller.Method(acctProfile)" result="viewScope.profileForm"/> …
Run Code Online (Sandbox Code Playgroud)

java spring-webflow

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

Spring Web Flow异常处理

如何防止异常,如果requestParameters.sortBy传递为string(java.lang.NumberFormatException)或缺少(java.lang.NullPointerException)?

<view-state id="journeySearch" model="journeyForm">

     ...

    <transition on="sort">
        <set name="journeyCriteria.sortBy" value="requestParameters.sortBy" type="int" />
        <evaluate expression="bookingService.searchJourneys(journeyCriteria)" result="viewScope.journeys" /> 
    </transition>
</view-state>
Run Code Online (Sandbox Code Playgroud)

spring spring-webflow spring-webflow-2

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

使用 spring security 存储登录用户的其他详细信息

我正在寻找使用 Spring Security 在整个应用程序中存储和显示登录用户的其他详细信息的正确方法。

例如,我想在每一页的顶部显示Welcome:Mr.Smith(管理员,数学部)。为此,我想获取登录用户的前缀、姓氏、名称和部门。

我正在使用自定义UserDetails服务从数据库中获取用户。在浏览时,我发现AuthenticationhasgetDetails()可以存储与身份验证相关的其他详细信息,我可以使用该方法存储其他详细信息吗?

如果是,你能举一个简单的例子吗?我可以AuthenticationSuccessHanlder用来做这项工作,还是我以完全错误的方式看待问题?我不应该在 spring 安全层处理这个吗?我应该在哪里照顾它?

spring spring-mvc spring-security spring-webflow

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

在Spring Webflow中,如何从失败的on-start评估转换

我是Spring Webflow的新手,我正在尝试修改现有的流来检查用户根据几个规则使用流的授权.似乎没有一种明显的(广泛记录的)从评估过渡到某种终止条件的方法.我理解的转换不允许在开始时使用.抛出异常除了有一种优雅的过渡方式吗?谢谢.

这是为编辑创建的表单.我将授权检查代码添加到引用的方法中.我可以在此之前添加一个单独的评估来检查授权,但我仍然有转换问题.

<on-start>
    <evaluate        expression="solutionCreateEditFlowHelper.findDocumentForEdit(requestParameters.solutionId)" result="flowScope.documentForm"></evaluate>
Run Code Online (Sandbox Code Playgroud)

>

spring spring-webflow

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

如何从像/ resource/edit/n这样的URL启动Spring Web Flow

我想将Spring Web Flow主要用于其PRG功能.

假设我有类似于/widget/edit/99或的URL /widget/edit/123,其中数字代表id小部件.

我怎样才能开始/widget/edit流动,传入id

默认情况下,流URL看起来必须与流名称文件夹结构匹配.

我想保留网址/widget/edit/99而不是重定向.

(使用v 2.4)

spring-webflow

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

Spring Web Flow的优势是什么?

有人可以帮我理解Spring Web Flow的优点.我所理解的是

  1. 可以在XML文件中集中配置所有流.
  2. 不需要将数据从一个请求转移到另一个请求的开销,因为它可以通过流范围来完成.
  3. 它尤其适用于像Breadcrumbs导航这样的情况.
  4. 流可以进一步划分为子流以降低复杂性.

还有其他我没有调整过的吗?

spring-webflow

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

Grails Web Flow的第一个状态

关于Grails Web流程的第一个状态的一些问题:

  1. 是否可以有多个启动状态?
  2. 第一个州是否可能成为行动国家?
  3. 假设(2)的答案为否,我将数据传递到第一(查看)状态的选项是什么?我可以预先将它存储在会话中,但这不是很吸引人,因为我需要自己去处理它.理想情况下,我想在显示第一个(视图)状态之前将数据存储在流量范围内,但我不知道这是如何可能的

grails groovy spring-webflow

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

Spring webflow 2 - url映射不起作用

我正在使用spring mvc 3和webflow 2.我一直在关注在线资源,并一直试图让一个例子正常工作.我无法使webflow url映射生效.只有网络流不工作,mvc部分工作正常.

我一直得到的错误是:在名为'appServlet'的DispatcherServlet中找不到带有URI [/ Project2Admin/pizza]的HTTP请求的映射

我在下面粘贴了我的servlet-context.xml.

非常感谢您的帮助!欧弟


servlet的context.xml中

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:flow="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation="http://www.springframework.org/schema/mvc     http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
    http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd">

<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->

<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven/>  

<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />

<beans:bean class="org.springframework.web.servlet.view.tiles2.TilesViewResolver"/>

<beans:bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
    <beans:property name="definitions">
        <beans:list>
            <beans:value>/WEB-INF/views/**/views.xml</beans:value>
        </beans:list>
    </beans:property>
</beans:bean> …
Run Code Online (Sandbox Code Playgroud)

spring url-mapping spring-webflow spring-webflow-2

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