Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

embedded js file in doGet

 
Kirsten Newbury
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I working with a Tomcat 5.0 server. I use a doGet to send a page back to the client with code like the following:

public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException{

FormatGeneric fg = new FormatGeneric();
PrintWriter out = res.getWriter();
out.println(fg.pageOpen("Welcome to WIC Central"));
out.println("<img src=images/banner.jpg>");
out.println("<script type=text/javaScript src='jsBuildSurvey.js'></script>");
out.println("<form name='login' method='get' action='saveChanges'>");
out.println("<table cols=2>");
out.println("<tr><td><h2>WIC Cost Containment Program</td><td></h2></td></tr>");
out.println("<P><P>");
out.println("<tr><td>Vendor Information and Survey Input</td><td></td></tr>");
out.println("<tr><td>Enter Vendor Id provided:</td><td>");
out.println("</td></tr>");
out.println("<tr><td>Enter Vendor Password provided:</td><td>");
out.println("</td></tr>");
out.println("<tr><td></tr><td>"+fg.formatSubmit("submit", 20, "Login")+"</td></tr>");
out.println("</table>");
out.println("</form");
}

It properly creates the welcome page and displays the banner. The jsBuildSurvey script has a function called saveChanges(). But when I press the logit button, I get a "The page cannot be displayed" error message or a Tomcat message saying /WCCP/saveChanges is not available depending on what I try.

Help? Is my problem in the application web.xml file?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounss like a client-side debugging issue, so I'm moving this to the HTML forum for futher diagnosis.

Best thing to do (once moved), is to post the View Source of the HTML being sent to the browser.
 
Kirsten Newbury
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the view source.

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> Welcome to WIC Central</title></head><body bgcolor="white">
<img src=images/banner.jpg>
<script type=text/javaScript src='jsBuildSurvey.js'> </script>
<form name='login' method='get' action='saveChanges'>
<table cols=2>
<tr><td><h2>WIC Cost Containment Program</td><td></h2></td></tr>
<P><P>
<tr><td>Vendor Information and Survey Input</td><td></td></tr>
<tr><td>Enter Vendor Id provided:</td><td>
</td></tr>
<tr><td>Enter Vendor Password provided:</td><td>
</td></tr>
<tr><td></tr><td><input type='submit' name='submit' value='Logit' size='20'></td></tr>
</table>
</form
<P><P><P><P>
<tr><td colspan="2"></td> </tr></table></td></tr> </table></body></html>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your form action looks suspicious as it lacks any context path.
 
Kirsten Newbury
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so should action=jsbuildsurvey.savechanges() do the trick? Seems to me the src=jsbuildsurvey should bring in the script similar to an include statement. If that were true, then the savechanges() function ought to be there as part of the page at the client side?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"zutrekker",

You have changed your display name from one that is valid to one that is not.

Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Be aware that accounts with invalid display names are removed.

bear
JavaRanch Sheriff
[ November 12, 2006: Message edited by: Bear Bibeault ]
 
Kirsten Newbury
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have resolved the problem. It had to do with a conflict in the fg.pageOpen() line. Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic