Hello,
I'm stuck in my head, here's my tiny little problem: I want to submit
a list of Long values to an action bean. These values are database
ids, so i want them encrypted. The following solution is giving me
NullPointer exceptions in the TypeConverter. The generated Link is not
looking like I'd expect it to look:
/app/administration/ConsultantRoles.htm?consultantId=sN4P-XQFPKw%3D&assignedRoleIds%5B0%5D=1

This is the sourceCode:

ConsultantRolesActionBean:
private List<Long> selectedIds;

public ConsultantRolesActionBean() {
        assignedRoleIds = new ArrayList<Long>();
}

@ValidateNestedProperties(
{ @Validate(on = "view", encrypted = true) })
public void setAssignedRoleIds(List<Long> assignedRoleIds) {
        this.assignedRoleIds = assignedRoleIds;
}

jsp:
<s:url var="assignRolesUrl"
beanclass="xyz.controller.app.administration.ConsultantRolesActionBean">
        <s:param name="consultantId" value="${consultant.id}"/>
        <c:forEach var="role" items="${consultant.assignedRoles}"
varStatus="rolesStatus">
                <s:param name="assignedRoleIds[${rolesStatus.index}]" 
value="${role.id}"/>
        </c:forEach>
</s:url>

Also tryed to change the validation annotation to:
@Validate(on = "view", encrypted = true)
public void setAssignedRoleIds(List<Long> assignedRoleIds) {
        this.assignedRoleIds = assignedRoleIds;
}

This results in the following url:
/app/administration/ConsultantRoles.htm?consultantId=QecNk2hZxBY%3D&assignedRoleIds%5B0%5D=1

and the same exception. To be complete here's the logMessage:
[ WARN] 10:12:47
net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder:90
- Looks like type converter
net.sourceforge.stripes.validation.longtypeconver...@103fbbe threw an
exception.
java.lang.NullPointerException
        at 
net.sourceforge.stripes.validation.NumberTypeConverterSupport.preprocess(NumberTypeConverterSupport.java:94)
        at 
net.sourceforge.stripes.validation.NumberTypeConverterSupport.parse(NumberTypeConverterSupport.java:68)
        at 
net.sourceforge.stripes.validation.LongTypeConverter.convert(LongTypeConverter.java:36)
        at 
net.sourceforge.stripes.validation.LongTypeConverter.convert(LongTypeConverter.java:25)
        at 
net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder.convert(DefaultActionBeanPropertyBinder.java:792)
        at 
net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder.bind(DefaultActionBeanPropertyBinder.java:182)
        at 
net.sourceforge.stripes.controller.DispatcherHelper$3.intercept(DispatcherHelper.java:194)
        at 
net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:158)
        at 
net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:113)
        at 
net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
        at 
net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:74)
        at 
net.sourceforge.stripes.controller.DispatcherHelper.doBindingAndValidation(DispatcherHelper.java:190)
        at 
net.sourceforge.stripes.controller.DispatcherServlet.doBindingAndValidation(DispatcherServlet.java:254)
        at 
net.sourceforge.stripes.controller.DispatcherServlet.service(DispatcherServlet.java:148)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:247)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:67)
        at 
com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:115)
        at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:110)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:595)

Any hints how to bind a list of Longs?
Thanks,
Richard

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to