Thursday, April 29, 2010

How to generate servlet source from a JSP


Understanding the XML view

The core JSP syntax is made up of scriptlets, actions, directives, expressions and declarations defined by the JSP specification. Web browsers do not understand JSP syntax as they do HTML. For the browser to display the contents of a JSP page, JRun must first compile the JSP source as a servlet which JRun then uses to generate the response. The response is HTML or whatever markup language is requested. However, the JSP-to-servlet compilation process is not a direct one. The JSP must first be transformed into XML.

The following steps occur when a JSP is requested for the first time:

  1. A client requests a JSP for the first time.
  2. JRun converts the JSP into a temporary XML representation called the XML view.
  3. JRun validates the XML view of the JSP page.
  4. JRun transforms the XML view into a .java class file that extends jrun.jsp.runtime.HttpJSPServlet and implements jrun.jsp.runtime.JRunJspPage. You can view the servlet's source code as described in "Viewing servlet source code".
  5. JRun compiles the new class into a servlet.
  6. The servlet generates the output based on the client request.

The following image shows the lifecycle of a JSP page when it is first requested by a client and finally compiled into a servlet. The servlet then returns the request to the client.

This images shows the flow of a JSP page when it is first requested by a client. The JSP page goes from *.JSP to XML View to *.JAVA to a compiled servlet. Then the servlet returns the request to the client.

Viewing servlet source code

You can view the source code of the servlet representation of the JSP page. You cannot view the XML view of the JSP page because it is only maintained in memory temporarily while JRun constructs the servlet.

JRun does not keep servlets generated from JSP source code by default. This section shows you how to configure JRun to keep the Java files and where to view them.

To keep generated JSPs:

  1. In the jrun_root/servers/jrun_server/SERVER-INF/default-web.xml file, set the JSPServlet's keepGenerated initialization parameter to true, as shown in the following example:
     <servlet>
         <servlet-name>JSPServlet</servlet-name>
         <servlet-class>jrun.jsp.JSPServlet</servlet-class>
         <init-param>
               <param-name>keepGenerated</param-name>
               <param-value>true</param-value>
         </init-param>
     </servlet>
  2. Delete the JSP class files in the web application's /WEB-INF/jsp directory.

    Doing this removes the already-generated servlet class files. JRun checks for the existence of the class file before recompiling a JSP. If the class files were still available, JRun would not recompile the JSP. JRun also checks the data/time stamp of the JSP, so you can change the JSP source code and save the JSP file to cause JRun to regenerate the Java source code and recompile the class.

  3. Restart the JRun server.
  4. Request the JSP.
  5. Open the JSP's generated Java class file (*.java) in the web application's /WEB-INF/jsp directory. JRun names the source code files starting with "jrun__" and appends version information to the name.

Source: http://livedocs.adobe.com



Tuesday, April 27, 2010

How to created a shortcut on Pocket PC


Some programs don't create a shortcut on the Pocket Pc, at the same time we don't have a quick option to create on inside of the Pocket PC, here we have a couple ways to create a shortcut on the device.


You need to synchronize your Pocket PC, when is ready, Go to My Computer on your desktop and click Mobile Device. Navigate to the program for which you want to create the shortcut.
Right-click the program and select Create Shortcut. Right-click the shortcut and select Cut. Go to the \Windows\Start Menu\ folder under Mobile Device on your desktop, right-click inside the folder, and select Paste to paste the shortcut into the Pocket PC's Start menu.


You can use a small application provided by Scott & Ce Appt. named "NewShortcut" to create shortcuts without the need for ActiveSync, you can get it from the next link:


http://www.scottandmichelle.net/scott/cestuff.html




Friday, April 16, 2010

'SQLOLEDB' Reported an Error. Execution Terminated by the Provider Because a Resource Limit was Reached



When running a query from a remote server I am getting the next error:
'SQLOLEDB' Reported an Error. Execution Terminated by the Provider Because a Resource Limit was Reached

The problem is that the remote query timeout setting in Microsoft SQL Server is set too low for the query to complete.

In order to fix the problem we need to reset the time out value on the remote query settings.
To check the current value, execute the following command in Query Analyzer:
sp_configure 'remote query timeout'

To reset the remote query setting, execute the following commands in Query Analyzer:
sp_configure 'remote query timeout', n
go
reconfigure with override
go

Where n is the new timeout value.
Using '0' for n will set the timeout to infinite timeout.
This update should be performed by, or with the input of the database administrator to ensure the new setting is appropriate for your environment.


Source:
http://support.microsoft.com/kb/966725