This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to read JavaScript function from a Jsp

 
Shrikant Kulkarni
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am facing a problem while testing a JSP page which contains some Javascript code.
When we submit a login jsp page after giving valid userId and password, the control shifts to inbox_open page. When this login page reads a javascript code, i get an error like:

com.meterware.httpunit.ScriptException: Script 'openFrameworkWindow('/digite/Request?Key=framework_main&ContainedURL=inbox_open');' failed: org.mozilla.javascript.EcmaError: TypeError: Cannot set property "location" of undefined to "/digite/Request?Key=framework_main&ContainedURL=inbox_open" (httpunit#260)

What could be the problem?
I have already placed js.jar in the classpath. What more is required?

Pls help me.

Shrikant
 
Ken Loh
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could we have a look at your test codes ?
 
Shrikant Kulkarni
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yah here is my test code:
============================================================================

public void testGoodLogin() throws Exception {
WebConversation conversation=null;
WebResponse response=null;
WebRequest request =null;
String url = "http://localhost:8080/digite/Request?Key=login";
try{
conversation = new WebConversation();
request = new GetMethodWebRequest( url );
response = conversation.getResponse(request);
response = conversation.getCurrentPage();
WebForm form = response.getFormWithName("loginForm");
form.setParameter("loginId","admin");
form.setParameter("password","111111");
response = form.submit();
}
catch(Exception e) {
e.printStackTrace();
fail("Failure::::"+ e);
}
}
============================================================================

Pls any help

Shrikant
 
Ken Loh
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shrikant ks:
Yah here is my test code:

Pls any help

Shrikant
 
Ken Loh
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now, could you post us your jsp codes ? Appreciate it if you could wrap them in the code tags.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic