File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Calling onload event twice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Calling onload event twice" Watch "Calling onload event twice" New topic
Author

Calling onload event twice

Mark Reyes
Ranch Hand

Joined: Jul 09, 2007
Posts: 426
Hi Everyone,

I have one JSP wherein user needs to enter some data before hitting the submit button. The name of my JSP is ProcessData.jsp. In my ProcessData.jsp I want to handle the onload event of the JSP so I place,

body onload "processResult"

The function processResult was called during the first time the ProcessData.jsp was called.

Then after hitting the submit button, my action class will validate the required data. If any data is not entered correctly, I render my action class to forward it to action mapping of ERROR. But in this case, it will just forward to the same JSP(ProcessData.jsp).

Here's my struts-config.xml.




But my problem is, the onload event was not called so I can't alert the user for some error.

I have tried doing this in my servlet using RequestDispatcher then forward both the request and response object and the onload event was called accordingly. But I am trying to learn Struts.

Can I do it this way? thanks.


Sean Clark ---> I love this place!!!
Me ------> I definitely love this place!!!
Shane W
Ranch Hand

Joined: Aug 31, 2007
Posts: 30
hi
Onload will be called,for sure.
You need to send back the errors in some way and check for those in your method that is called on load of the page.

Apple Man
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

"Apple Man", please check your private messages. You can see them by clicking My Profile.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Dom Lassy
Ranch Hand

Joined: May 05, 2006
Posts: 181
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling onload event twice
 
Similar Threads
html:select html:options error, no getter. please help
Struts 1.1 using RAD7
html:link Submitting form
Struts Cancel Button submits the form
Display Check Boxes & Dropdowns in Struts with search results