我已经按照一些示例来重定向SWF并且每个都做到了相同。在我的情况下,链接不会重定向,执行参考不会更改,并且网址已更改为href的值。如果我在commandButton中设置它,那么结果就是成功。
我在glassfish 4上使用JSF 2.2和SWF 2.3。任何建议>谢谢!
<a href="${flowExecutionUrl}&_eventId=TRANSITION_NAME" >
我的链接
<a href="${flowExecutionUrl}&_eventId=visit" >
网址结果
http://localhost:8080/aio/spring/adminSpace?execution=e4s3&_eventId=visit
流程定义
<view-state id="showEvent" view="list_events.xhtml">
<secured attributes="ROLE_MEMBER" />
<on-entry>
<evaluate expression="eventProvider.showEvents()" result="viewScope.pagesList"/>
</on-entry>
<transition on="pageCreated" to="newEvent" />
<transition on="visit" to="visitEvent"/>
</view-state>
<view-state id="newEvent" view="newEvent_1.xhtml">
<secured attributes="ROLE_MEMBER" />
<on-render>
<set name="pictureProvider.idRequest" value="'event'" />
</on-render>
<transition on="back" to="showEvent" />
<transition on="save" to="showEvent" />
<on-exit>
<evaluate expression="eventProvider.deleteTempComponents()" />
</on-exit>
</view-state>
<view-state id="visitEvent" view="event.xhtml">
</view-state>
WebFlowConfig类
@Configuration
public class WebFlowConfig extends AbstractFacesFlowConfiguration {
@Bean
public FlowExecutor flowExecutor() {
return getFlowExecutorBuilder(flowRegistry())
.addFlowExecutionListener(new FlowFacesContextLifecycleListener())
.addFlowExecutionListener(new SecurityFlowExecutionListener())
.build();
}
@Bean
public FlowDefinitionRegistry flowRegistry() {
return getFlowDefinitionRegistryBuilder(flowBuilderServices())
.setBasePath("/WEB-INF/flows")
.addFlowLocationPattern("/**/*-flow.xml")
.build();
}
@Bean
public FlowBuilderServices flowBuilderServices() {
return getFlowBuilderServicesBuilder()
//.setViewFactoryCreator(new JsfViewFactoryCreator())
.setDevelopmentMode(true).build();
}
@Bean
public CustomScopeConfigurer customScopeConfigurer() {
Map<String, Object> scopes = new HashMap<String, Object>();
scopes.put("view", new ViewScope());
CustomScopeConfigurer configurer = new CustomScopeConfigurer();
configurer.setScopes(scopes);
return configurer;
}
}
WebMvcConfig类
@EnableWebMvc
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter{
@Autowired
private WebFlowConfig webFlowConfig;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("classpath:/resources/");
}
@Bean
public FlowHandlerMapping flowHandlerMapping() {
FlowHandlerMapping mapping = new FlowHandlerMapping();
mapping.setOrder(1);
mapping.setFlowRegistry(this.webFlowConfig.flowRegistry());
/* If no flow matches, map the path to a view, e.g. "/intro" maps to a view named "intro" */
mapping.setDefaultHandler(new UrlFilenameViewController());
return mapping;
}
@Bean
public FlowHandlerAdapter flowHandlerAdapter() {
JsfFlowHandlerAdapter adapter = new JsfFlowHandlerAdapter();
adapter.setFlowExecutor(this.webFlowConfig.flowExecutor());
return adapter;
}
@Bean
public UrlBasedViewResolver faceletsViewResolver() {
UrlBasedViewResolver resolver = new UrlBasedViewResolver();
resolver.setViewClass(JsfView.class);
resolver.setPrefix("/WEB-INF/");
resolver.setSuffix(".xhtml");
return resolver;
}
@Bean
public SimpleControllerHandlerAdapter simpleControllerHandlerAdapter() {
return new SimpleControllerHandlerAdapter();
}
@Bean
public SessionLocaleResolver localeResolver(){
SessionLocaleResolver localeResolver=new SessionLocaleResolver();
localeResolver.setDefaultLocale(new Locale("es"));
return localeResolver;
}
@Bean
public ReloadableResourceBundleMessageSource messageSource(){
ReloadableResourceBundleMessageSource msg=new ReloadableResourceBundleMessageSource();
msg.setBasename("classpath*:error");
return msg;
}
@Bean
public StandardServletMultipartResolver multipartResolver(){
return new StandardServletMultipartResolver();
}
/*
@Bean
public LocaleChangeInterceptor localeChangeInterceptor(){
LocaleChangeInterceptor changeInterceptor=new LocaleChangeInterceptor();
changeInterceptor.setParamName("locale");
return changeInterceptor;
}
@Bean
public ControllerClassNameHandlerMapping nameHandlerMapping(){
ControllerClassNameHandlerMapping controller=new ControllerClassNameHandlerMapping();
Object[] obj={localeChangeInterceptor()};
controller.setInterceptors(obj);
return controller;
}*/
}