aspose file tools*
The moose likes Struts and the fly likes how to show errors on the same page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to show errors on the same page?" Watch "how to show errors on the same page?" New topic
Author

how to show errors on the same page?

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
Hi there,

I have a tab.jsp page that when a user clicks, an action is performed - preparing the form to show previous information.



when the user add/edit the form and clicks SAVE, validation kicks in. If errors exists, the user should see the info on the form (obviously). The input in the struts-config.xml of the form points to the tab.jsp page, but when it gets there it perform the action (not good, because ignores the errors).

Q: how can I point to the same page and embed the errors without performing an action?

struts-config.xml:

displayUserGroups.jsp=tabs.jsp

Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Your question has me a little lost. If validation fails (your own validate method on the form or using the validator framework) then flow will be forward to your input attribute. In your case, it is a jsp file, so no action should be executed. You could set your input attribute to "/PrepearPayment.do" in which case that action will be called.

BTW...it looks like you have a little typo in PrepearPayment...should be PreparePayment but that does not make a difference.

- Brent
Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
well... if validation fails, the flow is forward to the input attribute page which is this:

<ajax:tab caption="Payments" baseUrl="${contextPath}/Prj/PrepearPayment.do"/>

so the PrepearPayment.do ignites the action; this is what I'm trying to avoid because the errors are lost.

hope this clarifies my question
 
 
subject: how to show errors on the same page?