Problem for getting the real path using one servlet and one jsp page
I have one tomcat machine and several virtual domains. Eahc virtual domain has one realpath in the disc.
I am using one servlet and one jsp page for using this servlet.
my purpose is to load, using the servlet , the real path for the domains (eahc domain has its path).
for this i make this:
the servlet code is this:
package utils.ticker;
import java.io.*;
import java.io.File;
import java.io.IOException;
import java.net.*;
import java.util.*;
import java.text.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public class Edicion extends HttpServlet{
public Edicion() {
public String cc(){
ServletContext myContext= getServletContext();
String abspath = myContext.getRealPath("/");
//here i want to return the real path
return abspath;
public static void main(String args[]){
and the jsp page is:
<%@ page import="utils.ticker.*" %>
<jsp:useBean id="tick" class="utils.ticker.Edicion" scope="session"/>
<html><head><body>
<%
tick.cc();
%>
</body></head></html>
But this produces one error, NullPointerException and dont shows me the real path.
Can anyone help me?
thanks
i have put this into one sevlet:
package utils.ticker;
import javax.servlet.ServletContext;
public class Edicion{
private ServletContext myContext;
public Edicion(ServletContext myContext) {
this.myContext = myContext;
public String getCC(){
return myContext.getRealPath("/");
and in the jsp page this:
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*"%>
<%@ page import="utils.ticker.*" %>
<jsp:useBean id="tick" class="utils.ticker.Edicion" scope="session"/>
<html><head><body>
<%=tick.getCC()%>
</body></head></html>
but appear this error in the tomcat.
Can you, please, help me. i am trying to solve this during one week and i am desesperate.
Thanks.
ERROR:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: class utils.ticker.Edicion : java.lang.InstantiationException: utils.ticker.Edicion
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
at java.lang.Thread.run(Thread.java:536)
root cause
javax.servlet.ServletException: class utils.ticker.Edicion : java.lang.InstantiationException: utils.ticker.Edicion
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
at org.apache.jsp.pruebas_jsp._jspService(pruebas_jsp.java:72)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
at java.lang.Thread.run(Thread.java:536)
Apache Tomcat/4.1.18
Similar Messages
-
How to get the real path of the xml file
I have a java application
following is the package structure
com>>gts>>xml
having file---------> MyXML.xml
com>>gts>>java
having java program to read the file
Problem is if I use File file = new File("..\\xml\\MyXML.xml");
java.io.FileNotFoundException: E:\LEARNING_WORK_SPACE\JavaXml\..\xml\MyXml.xml (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
How do I get the real path of the xml file.
Edited by: shashiwagh on Jan 29, 2010 11:46 AMHi,
if your XML file is inside a package you can easily get it from the classloader.
Note that your application maybe packaged inside a jar so it is not safe to use java.io.File for this purpose.
You have an xml file in :
com/gts/xml/MyXML.xml
in a class of the same module (that will packaged in the same jar) for example com.gts.java.XmlLoader :
// To get the stream :
InputStream is = this.getClass().getResourceAsStream("/com/gts/xml/MyXML.xml");
// Or the URL :
URL xml = this.getClass().getResource("/com/gts/xml/MyXML.xml");Hope it helps. -
How do I get the real path!!!
I am trying to get the real path:
http://xxxxx/listusers.do?section=xxx
But when I am using request. getRequestURI() I get
listuser.jsp which is the value that listusers.do returns.
How do I get the real path?????hehe
You can't get the real path from a virtual
path..that's why you have virtual paths. -
What is the real time use of implicit and explicit cursors in pl/sql
what is the real time use of implicit and explicit cursors in pl/sql.............please tell me
You can check the following link ->
http://www.smart-soft.co.uk/Oracle/oracle-plsql-tutorial-part5.htm
But, i've a question ->
Are you student?
Regards.
Satyaki De. -
How to get the real path of the application in a JavaBean?
Hi everyone,
I know this has been asked several times before, but I I am not really satisfied with the answers... :-)
I am writing a webapp which uses XML files for storing information, the "business" logic is in JavaBeans. So far I just used hardcoded paths, now I will have to put the thing on a server and need a better solution.
I understand I can use getServletContext().getRealpath() but that doesn't work in a Bean.
One solution would be to fill a (hidden) field calling that and passing the field to the Bean, but I don't really like that solution.
I am using Java Studio Creator 2 (Update 1), isn't there a way to access the ApplicationBean instance in my JavaBeans? As I understand it, I could get the path from there as well.
Thanks!When you create the bean that contains the business logic you will have to pass in the real path either as a constructor parameter or by setting a property of the bean.
-
How to get the Real Path of a file which is accessed by URL?
iam using tomcat6.0.
I have a file xyz.xml at the top of the webapplication HFUSE which i can able to access by URL
http://localhost:8080/HFUSE/xyz.xml
My problem is how to get the realpath of the file "xyz.xml" for reading and writing purposes.
I tried various things but i could not able to successfully solved the problem?
1) File f = new File("/xyz.xml");
print(f.getAbsolutePath()) ============== it is not fetching the file @ http://localhost:8080/HFUSE/xyz.xml rather it is creating a file
at the root of the drive where eclipse is running.
2) File f = new File("xyz.xml");============> this is also not working , it is creating the file xyz.xml in the eclipse directory ..................
Can anyone please guide on this problem?RevertInIslam wrote:
If you want your context root(i.e HFUSE)
use this:
request.getContextPath() //where request is HttpServletRequest object to get the needful path.
e.g:
File f = new File(request.getContextPath()+"/xyz.xml");//it will create the file inside HFUSE.
Hope this helps.
Regards
BWrong. The File constructor expects an absolute filesystem path. The HttpServletRequest#getContextPath() doesn't return the absolute filesystem path, it only returns the relative path from the current context root. Use ServletContext#getRealPath() instead, it returns the absolute filesystem path for the given relative path from the current context root.
File file = new File(servletContext.getRealPath("/"), "xyz.xml"); -
Error getting values by getParameterValues() in a servlet from a jsp page
Hi, i cant recive in my servlet the values that a user write in some input text in the next page:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="/ProyectoWeb/ServletPruebas" method="post">
<table>
<%
for(int i = 0; i<10; i++){
%>
<tr>
<td>
<input type="hidden" name="ps_oculto" value="<%=i%>">
<input type="text" name="ps_valor">
</td>
</tr>
<%
%>
</table>
<input type="submit" value="VALOR">
</form>
</body>
</html>and this is the post method of my servlet:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter pw = response.getWriter();
String[] pocultos= request.getParameterValues("ps_oculto");
String[] valores= request.getParameterValues("ps_oculto");
for(String oculto: pocultos){
pw.println("ps_ocultos: " + oculto);
for(String valor: valores){
pw.println("ps_valores: " + valor);
pw.flush();
pw.close();
}When i open the jsp page in my web server and do the sumit of its form i get the folow response of my servlet:
ps_ocultos: 0
ps_ocultos: 1
ps_ocultos: 2
ps_ocultos: 3
ps_ocultos: 4
ps_ocultos: 5
ps_ocultos: 6
ps_ocultos: 7
ps_ocultos: 8
ps_ocultos: 9
valores: 0
valores: 1
valores: 2
valores: 3
valores: 4
valores: 5
valores: 6
valores: 7
valores: 8
valores: 9
I can´t get the values that i put in the input text when i open the jsp in my web server, (before press the submit button i write text in the input text), i only get indexes 0,1,2,3 ... What is wrong?
Thanks in advanceMy error its on the post method. I am getting the worg parameter for the values of my input text. I have change in the doPost the line
String[] valores= request.getParameterValues("ps_oculto");for this
String[] valores= request.getParameterValues("ps_valores");the code run perfect. Sometimes happens ... -
How to get the value from a database without submitting a jsp page
I have a jsp which has a text box depending on the value entered I want to get the value from a database for other two fields with out submitting jsp page. I am using struts.
Thanks For any assistance provided.Alright,here is an example for you for the first case.
Present.jsp:
============
<html:html>
<head>
<title><html:message key="page.title"/></title>
</head>
<body>
<html:form action="ChangeEvent.do">
<html:hidden property="method"/>
<!-- Submitting the Form onKeyUp of EmpId field and trying to save the
state of the Form in the scope of session -->
Emp Id:<html:text property="empId" size="5" onkeyup="if(true){this.form.elements[0].value='populateDetails';this.form.submit();}"/>
Emp Name:<html:text property="empName" size="10" />
Email Address:<html:text property="email" size="10" />
<html:submit>Submit</html:submit>
</html:form>
</body>
</html:html>struts-config.xml:
==================
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<!-- Form bean which stores the properties of all the Form elements -->
<form-beans>
<form-bean name="employeeFormBean" type="org.apache.struts.action.DynaActionForm">
<form-property name="empId" type="java.lang.String"/>
<form-property name="empName" type="java.lang.String"/>
<form-property name="email" type="java.lang.String" />
</form-bean>
</form-bean>
<action-mappings>
<action path="/ChangeEvent" type="Test.GetChangeAction" name="employeeFormBean" scope="request" parameter="method">
<!-- On successful call of DB the Page has to be forwarded to the same page again by
uploading updated form bean values. -->
<forward name="success" path="/Present.jsp"></forward>
<forward name="failed" path="/error.jsp"></forward>
</action>
</action-mappings>
</struts-config>GetChangeAction.java:
=====================
public class GetChangeAction extends DispatchAction{
public ActionForward populateDetails(ActionMapping mapping,ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
DynaActionForm dForm = (DynaActionForm)form;
String empId = dForm.get("empId");
// calling Model / Db and then getting back Employee Details
EmployeeBean eb = ModelUtils.getDetails(empId);
// Updating form bean by updating values from the Model
dForm.set("empName".eb.getEmpName());
dForm.set("email".eb.getEmail());
return mapping.findForward("success");
}well to me this should work regardless to any browser but we need to make sure we put in our logic properly. -
How can a user scroll the resultset obtained from a servlet in a jsp page?
Actually i am having a page where user has to select company name and for tht i am providing him with a button, and on clicking tht button a
new search page is provided , and on mentioning the search criteria ,a servlet is fired which returns a list of companies(tbasically i am creating a session object of resultset type which stores the companies name), now the servlets again goes back to search page, and here i want 2 display the company names, i am able to display company names in my search page , but now i want my user to select one of the companies from tht servlet.
for tht i need to tap the onMouseOver function of java SCript, C
Can any one tell me how to write code for tht
Thanking in Advancesee https://addons.mozilla.org/en-US/thunderbird/addon/send-later-3/
-
Et the real path from one filter (servlet)
Whit this:
String rutaDisco = ((HttpServletRequest)request).getRealPath("/");
i get the real path, but this is deprecated.
which is the equivalent in 1,4?
how can i use the equivalent for loading the real path?
thanksIn your Filter call: ServletContext application = null;
public void init(FilterConfig config) {
application = config.getServletContext();
}Using the ServletContext you can call ServletContext.getRealPath(String path);
Cheers,
Anthony -
How to get the complete path of the file that is selected using FormFile
i m working on struts..
i hv used FormFile like
<html:file property="xsdpath" value="Browse" />
need to get the whole path that i will select using browse button
for example d:\foldername\filename.java
but FormFile Api has a method getFileName(); which returns the filename, for getting the absolute path wat has to be done.
please reply bak soon
thanks in advancehere i use formfile <html:file> just to allow the
user to select a xml file .
so i need to get the whole path of the selectedfile
to parse the xml file.No you dont.
You would definitely benefit from further reading on
file upload.
<html:file> tag renders an HTML <input> element of
type file.
When a user uploads a file, this file is sent as a
stream of data, which a program (jsp/servlet) on the
server, reads and stores the data back in the form
of a file on the server.
Any server program that needs to parse the file,
should do so on the file stored on the server.
There's no point in knowing the absolute path of the
file on the client machine. If a server program can
parse a file on the client machine, why upload the
file in first case ? Get the drift ?
i also want to show my user the path he hadselected.
If you have such a requirement, then yes.
But it sounds weird to me. If you see my response
above, you will realize that the server has a copy of
the client's file uploaded and then parsed. What if
the client has changed his file after upload ?
cheers,
ram.I also have a requirement to get the whole filepath of the file selected and place this information into a table. From FormFile I can only retreive the absolute filename
Any suggestions would be helpful.
Thanks, dam -
Have a problem in getting the servlet path
hi
i wanna get the complete path to my servlet folder in TomcatServer
like http://localhost:8084/Test can anyone tell me how can i get it plz.try ServletContext.getRealPath
Returns a String containing the real path for a given virtual path. For example, the path "/index.html" returns the absolute file path on the server's filesystem would be served by a request for "http://host/contextPath/index.html", where contextPath is the context path of this ServletContext.
The real path returned will be in a form appropriate to the computer and operating system on which the servlet container is running, including the proper path separators. This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive). -
How can I find the real path to servlet class
Hi,
I am facing an issue. Am in the process of creating a filter which would send a Last-modified along with the header. For this I will be checking the is-modified-since
header and lastModified date of the file.
The problem I am facing is that after taking the file part from the request and checking
the lastmodified date, it gives error. This is because i use,
String real_path = getServletContext().getRealPath(request.getServletPath());
and it would return the path to servlet-name and not to servlet-class, since servlet-name
is not physically present. It would return an error value.
Is there any way which I could find the real path to my servlet class file ?Remember you should not take the last mnodified date
of the class file or the jar file that contain the
class as the value for the getLastModified method
becouse the last modified date that should be used in
the caching is the last modified date of the dynamic
content that the servlet is about to prodice.
The same class file will produce different content
for different requests if not why do you use
servlets you can directly use the static contentThanks for a valuable remark.
Hence our getLastModified() often returns System.currentTimeMillis() result. -
Problem in getting public holiday class using function module
Hi to all
I am using function module
HR_PERSON_READ_WORK_SCHEDULE.
for getting the employee's actual work schedule and public holiday class FTKLA.
But I am unable to get the correct public holiday class.
Please guide me.
How to do that.
Regards
AnubhavHi,
form build_work_schedule tables b_psp structure pdpsp
b_day_psp structure pdsppsp
b_employees structure pdpnr
using value(b_begda) like sy-datum
value(b_endda) like sy-datum
value(b_read_db) type c.
data: counter type i. "Note 495298
call function 'HR_PERSON_READ_WORK_SCHEDULE'
exporting
begin_date = b_begda
end_date = b_endda
grouping_dws = motpr "VEX Modif
grouping_attendence = moabw
grouping_substitute = mover
read_from_database = b_read_db
im_read_no_locked_records = 'X' "803380
tables
pernr_tab = b_employees
psp = b_psp
day_psp = b_day_psp
exceptions
error_in_build_psp = 1
others = 2.
read table b_employees with key error = 'X'
transporting pernr.
if sy-subrc eq 0.
read table d3000_pers with key pernr = b_employees-pernr
transporting name.
if sy-subrc eq 0.
message s582 with d3000_pers-name.
else.
message s582 with b_employees-pernr.
endif.
endif.
Hope it helps you. -
Get the context path with jspx
How can I get the context path using jspx?
with jsp I get using scriptlet
<%=request.getContextPath()%>but it didn't validate with xhtml
thanksI'm really unfamiliar with JSP Documents and I don't know if nesting the tags would be valid. Why don't you use EL in that case?
${pageContext.request.contextPath} will print out the value you need.
P.S. In case it just prints out as is without being evaluated, take a look at these:
http://faq.javaranch.com/java/ElOrJstlNotWorkingAsExpected
http://faq.javaranch.com/java/JstlTagLibDefinitions
http://faq.javaranch.com/java/SetupJstlForJsp2
http://faq.javaranch.com/java/ServletsWebXml
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
(Yes I know it's on JavaRanch but I think it applies everywhere)
----------------------------------------------------------------
Maybe you are looking for
-
How or where do I find the app in the iphone, the provider says it is stored somewhere?
-
How do you transfer money from one account to another
How do you transfer money from one account to another?
-
Do I need a voltage converter to power Macbook pro in UK?
Do I need a voltage converter to power a Macbook Pro in the UK?
-
How to put authorization on closing open item list
Hi to everyone! How can i put authorization on closing the open item list and partially closed open item list. Thanks Rohan
-
Save the stage as image at runtime in projector
Hi, I m very new to Director. I m using Director MX 2004. There is a button and a flash file embedded in the director. Now, on clicking the button should open the "Save as" dilogue box and save the swf as image. Generally, the program should take the