application.showURL isn't doing what I want

Using Servoy to administrate the content of your website? Discuss all webrelated Servoy topics on this forum!

application.showURL isn't doing what I want

Postby Foobrother » Tue Jan 27, 2009 11:31 am

Hi everybody,

I would like to open an URL from the Smart Client into asmall IE pop-up window. And after few seconds auto-closing it.
But it opens the url as a tab in IE and in full size, and it auto-closes because of the script which is into the <body> beacon.

Here is the code I typed to do it:
Code: Select all
application.showURL('http://localhost:8080/examples/doc2pdf.jsp','_blank','top=240,left=380,resizable=no,width=400,height=135',5);


And here is the page content:
Code: Select all
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import = "java.util.*" %>
<%@ page import = "com.servoy.j2db.server.headlessclient.*" %>
<%@ page import = "com.servoy.j2db.util.*" %>
<%@ page import = "com.servoy.j2db.dataprocessing.IDataSet" %>
<%@ page errorPage="errorpage.jsp" %>
<%
   ISessionBean servoy_hc = (ISessionBean)session.getAttribute("servoy");
   if (servoy_hc == null)
   {
      servoy_hc = HeadlessClientFactory.createSessionBean(request,"doc2pdf_test");
      session.setAttribute("servoy",servoy_hc);
   }
   boolean ok = servoy_hc.setMainForm("testForm");
   if (!ok)
   {
      out.print("error cannot work on required form");
      return;
   }else{
      String browse = request.getParameter("browse");
   }
%>
<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Servoy Headless Client test</title>
</head>
<body onLoad="setTimeout(window.close(), 5000)">
Generating...<BR>
<%
   servoy_hc.executeMethod(null,"genPDF",null);
   out.print("END");
%>

</body>
</html>
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: application.showURL isn't doing what I want

Postby IT2Be » Tue Jan 27, 2009 12:24 pm

Clever solution :)

But is that what you want in any way related to Servoy or is that just how IE behaves?

I am not sure if and how you can solve that (other than through preference settings in IE)...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Re: application.showURL isn't doing what I want

Postby Foobrother » Tue Jan 27, 2009 1:12 pm

IT2Be wrote:Clever solution :)

Thank you :o

IT2Be wrote:But is that what you want in any way related to Servoy or is that just how IE behaves?

I want the window to be poped-up as new small IE window. I don't want it to be opened as a new tab.
Refering to the JavaDoc showURL should do the job.

IT2Be wrote:I am not sure if and how you can solve that (other than through preference settings in IE)...

Yes, the pop-up might be blocked by IE (by the way when try to auto-close it asks me if I want to close!). But I should be able to create a pop-up?!
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: application.showURL isn't doing what I want

Postby Foobrother » Thu Jan 29, 2009 5:35 pm

I'm now trying to make my program working on the server (another machine). It works fine on my computer (using developer), but when I run it on the server it seems to be stuck when creating the headless client. I don't get any error in the logs. The only thing I see, is the headless client and my smart client on the "clients" section of the server.

Here is code of the JSP page which seems to cause the problem:
Code: Select all
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import = "java.util.*" %>
<%@ page import = "com.servoy.j2db.server.headlessclient.*" %>
<%@ page import = "com.servoy.j2db.util.*" %>
<%@ page import = "com.servoy.j2db.dataprocessing.IDataSet" %>
<%@ page errorPage="errorpage.jsp" %>

<html>
<head>

<meta http-equiv="refresh" content="2;url=doc2pdf3.jsp?idnb=<%= request.getParameter("idnb") %>; charset=UTF-8">
<title>PDF file Generator</title>
</head>
<body onLoad="window.moveTo((screen.availWidth/2)-125,(screen.availHeight/2)-300),window.resizeTo(200,250)">
<BR>
<%
   ISessionBean servoy_hc = (ISessionBean)session.getAttribute("servoy");
   if (servoy_hc == null)
   {
      servoy_hc = HeadlessClientFactory.createSessionBean(request,"doc2pdf_test");
      session.setAttribute("servoy",servoy_hc);
   }
   boolean ok = servoy_hc.setMainForm("testForm");
   if (!ok)
   {
      out.print("error cannot work on required form");
      return;
   }
   String docID = request.getParameter("docID");
   String idnb = request.getParameter("idnb");
   servoy_hc.executeMethod(null,"genPDF",new Object[]{docID,idnb});
   out.print("<center>PDF file check...</center>");
%>

</body>
</html>

And the line which seems to cause the problem is:
Code: Select all
servoy_hc = HeadlessClientFactory.createSessionBean(request,"doc2pdf_test");


doc2pdf_test is the solution name
testForm is the form which contains the genPDF method
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: application.showURL isn't doing what I want

Postby jcompagner » Thu Jun 11, 2009 11:56 am

what are you doing in "doc2pdf_test" ?
for example does it have an open solution method?
Does that one block somehow? Do you ask for user input?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Web Development

Who is online

Users browsing this forum: No registered users and 6 guests