Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Help Determining Why App is No Longer Working

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a new to JAVA and Struts. I had a working application until I decided to clean-up a few things (removed some SystemOut statements, removed duplicate code, etc.). Now the application is not working and I can't figure out why. Of course, I didn't bother to create a backup!!! I didn’t modify the jsp or the struts-config.xml file. There are no error messages in the console. Before I include pieces of my code, I wanted to know where to look to try to determine what’s causing the problem. Here’s a high level flow of what’s happening:

Index.jsp invokes an action that will load values into a dropdown box. It forwards “success”
RptReq2.jsp is invoked if “success” is returned
Form is displayed and the dropdown list is populated
Once a value is selected from the dropdown, an onchange event will trigger a JAVA script function that will populate the values in another dropdown box (same form is submitted)
There is a button on the form that will trigger another function via an onclick event (same form is submitted)
There is a submit button to create a report based on the values in the form (same form is submitted)


Everything was working okay as described above. Now that I have done some cleanup, the form comes up as expected and the first dropdown list is populated. However, when I make a selection nothing happens. I put alerts in the functions to see if they were being invoked, but I am not getting alerts now. I even added a temporary button to see if I could invoke a function, but no alerts where thrown. I put a sysout in the load action to make sure I was reaching the point where “success” is returned. I can see it on the console:

SystemOut O about to return success from LoadAction
[4/1/10 9:42:18:734 EDT] 0000002b ServletWrappe I SRVE0242I: [StrutsErrQueRptEAR] [/StrutsErrQueRpt] [/RptReq2.jsp]: Initialization successful

Any idea where I should start looking to try to figure out what is going on?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Liana Daughtry wrote:I didn't bother to create a backup


Or use a repository?! Horrible, horrible idea. And your IDE doesn't keep any local history?

I wanted to know where to look to try to determine what’s causing the problem.


Turn DEBUG logging on and check the logs.

However, when I make a selection nothing happens.


Oh, this is a *JavaScript* issue?

Use Firebug and see if you're getting JavaScript errors.
 
Liana Daughtry
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David, you are correct this was a javascript issue. I thought I didn't make any changes to the JSP, but it turns out I did. I took a look at my functions and remembered that I added another IF condition. Unfortunately, my ELSE IF syntax was incorrect. I did see that my functions in the HTML were underlined in red with a message stating that they were undefined. I ignored it because I could see that they were actually there!!! Silly me for not taking a closer look. Thanks for pointing me in the right direction!!! I knew it had to be something trivial, but I just wasn't sure where to look. My App is working again.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good deal. It was pretty clear it was a JavaScript issue as soon as you said that your JavaScript wasn't working--so that's the logical place to look first.
 
Creativity is allowing yourself to make mistakes; art is knowing which ones to keep. Keep this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic