• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

pageflow validation problem

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, I'm trying a test app to do validation on a pageflow. The validation code in the controller.java file doesn't work; instead a message appears in the console shell saying, "No ValidatorAction called long found for field ssn"

Any ideas what could be wrong? Thanks

The file listings appear below.



controller.java:

import javax.servlet.http.HttpSession;

import org.apache.beehive.netui.pageflow.Forward;
import org.apache.beehive.netui.pageflow.PageFlowController;
import org.apache.beehive.netui.pageflow.annotations.Jpf;
import forms.ProfileForm;

@Jpf.Controller(
simpleActions={
@Jpf.SimpleAction(name="begin", path="index.jsp")
/* The next line is commented out - "processData" is the name of the action,
not "tonextpage"
@Jpf.SimpleAction(name="tonextpage", path="page2.jsp")
*/ },
sharedFlowRefs={
@Jpf.SharedFlowRef(name="shared", type=shared.SharedFlow.class)
}
)
public class Controller
extends PageFlowController
{
@Jpf.Action(
forwards = {
@Jpf.Forward(name="success", path="displayData.jsp")
},
validatableProperties={
@Jpf.ValidatableProperty(
propertyName = "ssn",
validateRange = @Jpf.ValidateRange(minInt = 100000000, maxInt = 999999999))
},
validationErrorForward =
@Jpf.Forward(name="fail", navigateTo=Jpf.NavigateTo.currentPage)
)
public Forward processData(ProfileForm form)
{
System.out.println("Name: " + form.getTitle());
System.out.println("Kingdom: " + form.getKingdom());
System.out.println("Species: " + form.getSpecies());
System.out.println("SSN: " + form.getSsn());
getRequest().setAttribute("features", form);
return new Forward("success");
}

@Jpf.SharedFlowField(name="shared")
private shared.SharedFlow sharedFlow;

/**
* Callback that is invoked when this controller instance is created.
*/
protected void onCreate()
{
}

/**
* Callback that is invoked when this controller instance is destroyed.
*/
protected void onDestroy(HttpSession session)
{
}
}

index.jsp:

<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0" prefix="netui-data"%>
<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%>
<netui:html>
<head>
<title>Web Application Page</title>
<netui:base/>
</head>
<netui:body>
<p>
New Web Application Page
</p>
<%--the next line could also be --%>
<%--<netui:anchor action="tonextpage">Link to page2.jsp</netui:anchor>--%>
<%--in which case the line, --%>
<%--@Jpf.SimpleAction(name="tonextpage", path="page2.jsp")--%>
<%--in the controller.java would need to be included--%>

<netui:anchor action="processData">Link to page2.jsp</netui:anchor>
<p>
<netui:form action="processData">
Title: <netui:textBox dataSource="actionForm.title"/>
<br/>
Kingdom: <netui:textBox dataSource="actionForm.kingdom"/>
<br/>
Species: <netui:textBox dataSource="actionForm.species"/>
<br/>
SSN: <netui:textBox dataSource="actionForm.ssn"/>
<netui:error key="ssn"/>
<br/>
<netui:button type="submit" value="Submit"/>
</netui:form>
</p>

</netui:body>
</netui:html>
reply
    Bookmark Topic Watch Topic
  • New Topic