Friday, 20 September 2013

Troubleshooting silent installation

 InstallShield uses result codes to indicate the status of a silent installation process. A result code of 0 indicates success. Any other result code indicates that the silent installation failed.

To determine the status of your silent installation process, check the setup.log file. The [ResponseResult] contains one of the below given result codes.

0 Success.

-1 General error.

-2 Invalid mode.

-3 Required data not found in the Setup.iss file.

-4 Not enough memory available.

-5 File does not exist.

-6 Cannot write to the response file.

-7 Unable to write to the log file.

-8 Invalid path to the InstallShield Silent response file.

-9 Not a valid list type (string or number).

-10 Data type is invalid.

-11 Unknown error during setup.

-12 Dialog boxes are out of order.

-51 Cannot create the specified folder.

-52 Cannot access the specified file or folder.

-53 Invalid option selected.


Command to create the log file during the silent installation:-

/f2<path\LogFile> or -f2<path\LogFile>

Specifies an alternate location and name of the log file created by InstallShield Silent. By default, Setup.log log file is created and stored in the same directory as that of Setup.iss.

Get Absolute path of a url in JAVA or JSP



We can use ServletContext.getRealPath(), to get the absolute path of the given URL.

Example:-

<% String path = request.getRealPath("/");

out.println("Real path: " + path);

%>

Result:-

Real path: C:\Program Files (x86)\Apache Software Foundation\Tomcat 5.5\webapps\ROOT



Note that it does not necessarily work in all situations. For example, if your Tomcat is configured to deploy the .war file without unpacking it, then this will return null.

Thursday, 19 September 2013

Define Java mehtods in JSP pages

  Each JSP compiles to a separate class, so there are classes involved. If you are reusing the code chunks in the same JSP, then you can declare a method to appear in the JSP class. The JSP Declarations are used to declare variables and methods in the scripting language used in a JSP page. A declaration should be a complete declarative statement, or sequence thereof according to the syntax of the scripting language specified. The JSP declaration syntax is:

<%! declaration(s) %>
  • Declarations do not produce any output into the current out stream.
  • Declarations are initialized when the JSP page is initialized and are made available to other declarations, scriptlets, and expressions.
  • Declarations declare methods global to the page.
Example:-

<%!

public String getMsg(String name){
String msg="Hi";
msg=msg+" "+name;
return msg;
}

%>

You can then invoke the function within scriptlets or expressions:
<%= getMsg("Ram") %>