• 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

Calling onload event twice

 
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Apple Man", please check your private messages. You can see them by clicking My Profile.
 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
reply
    Bookmark Topic Watch Topic
  • New Topic