Posts

Using javascript pass form variables to iframe src

Image
   Open PDF in Bootstrap Modal Window   This tutorial shows How to pass a JavaScript/jQuery variable to bootstrap modal view and sets it to iframe  src attribute. It passes value dynamically to src attribute of the iframe. When the user clicks a link, it opens the URL in a popup window. This  code shows the PDF in a Model without download option by hiding the toolbar.  To show PDF toolbar in modal, just add #toolbar=1   in the above script. index.php <!DOCTYPE html> <html lang= "en" > <head> <title>Bootstrap Model with PDF Example - coding-zon</title> <meta charset= "utf-8" > <meta name= "viewport" content= "width=device-width, initial-scale=1" > <link rel= "stylesheet" href= "https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" > <script src= "https://cdn.jsdelivr.net/npm/jquery@3.6.1/dist/jquery.slim....

Java Networking Datagrams Tutorial

Image
Client server communication with Datagrams     Java Networks Home Generally, Datagrams are transmits  packets of information between machines. Once the datagram has released to its intended target, there is no assurance that it will arrive without loss of data. Java implements datagrams on top of UDP protocol by using 2 classes. They are.. 1 . DatagramSocket constructors DatagramSocket() throws SocketException DatagramSocket( int port) throws SocketException DatagramSocket( int port,InetAddrss ipaddress) throws SocketException DatagramSocket(SocketAddress address) throws SocketException SocketAddress It is an abstract class implemented by concrete class InetSocketAddress. It encapsulates an IP address with a port no. methods void send (DatagramPacket packet) throws IOException void receive (DatagramPacket packet) throws IOException 2 . DatagramPacket its object is the data container. DatagramPacket ( byte data[], int size) DatagramPack...

Java Network Classes Part2

Image
  Java Networking Tutorial   Goto Part1   HttpURLConnection class   It is the subclass URLConnection Provides support for HTTP connctions on port 80. to open a connection we use openConnection on a URL object and must cast the result to HttpURLConnection. methods   getRequestMethod() getResponseCode() getResponseMessage() getHeaderFields()   import java.net.* ; import java.io.* ; public class HttpURLDemo { public static void main (String[] args) throws IOException { URL hp = new URL( "http://www.google.com" ); HttURLConnection hpCon = (HttpURLDemo) hp. openConnection (); System. out . println ( "Request method is" +hpCon. getRequestMethod ()); System. out . println ( "Response code is" +hpCon. getResponseCode ()); System. out . println ( "Requst method is" +hpCon. getResponseMessage ()); Map<String>,List<String> hdrMap=hpCon. getHeaderFields ()); Set<String> hdrField = hdrMap. keySet...