Failed validation will send user back to the input result.

Dave
 On Nov 17, 2010 2:29 PM, "Harsh C" <hchau...@gmail.com> wrote:
> Hi,
>
> I have an input page which has a checkbox list in a form. Clicking submit
> takes the user to a 2nd JSP.
> The problem is that when I don't select a checkbox and click on submit, I
> get to the output page, of course no value is displayed on the output page
> though.
> But if I select a checkbox and click submit, I get an error saying....
>
> No result defined for action .....action.ModelHomeAction and result input
> I just started with struts and don't really know why it is looking for the
> result "input". I would appreciate any help with this.
>
> Relevant code is below.
>
> input.jsp
> <s:form method="post" action="modelUpload">
> <s:checkboxlist name="selectedModel" list="modelList" listKey="modelId"
> listValue="modelName"/>
> <s:submit></s:submit>
> </s:form>
>
> output.jsp
>
> <s:property value="selectedModel"/>
>
> Action
> private ArrayList<Model> modelList;
> private Model selectedModel = new Model();
>
> public ArrayList<Model> getModelList() {
> FrameworkHandler handler = new FrameworkHandler();
> return handler.getModels();
> }
>
> public void setModelList(ArrayList<Model> modelList) {
> this.modelList = modelList;
> }
>
> public Model getSelectedModel() {
> return selectedModel;
> }
>
> public void setSelectedModel(Model selectedModel) {
> this.selectedModel = selectedModel;
> }
>
> public String execute() throws Exception {
> LOG.debug("Model Home Action");
> return SUCCESS;
> }
>
> public String upload() throws Exception{
> return SUCCESS;
> }
>
> struts.xml
>
> <action name="modelHome" class=".....action.ModelHomeAction"
> method="execute">
> <result name="success">/jsp/input.jsp</result>
> </action>
>
> <action name="modelUpload" class=".....action.ModelHomeAction"
> method="upload">
> <result name="success">/jsp/output.jsp</result>
> </action>

Reply via email to