JavaScript tags in HTML document throws a parsing error


PHP Fatal error: Uncaught Spipu\Html2Pdf\Exception\HtmlParsingException: The HTML tag provided is invalid in /vendor/spipu/html2pdf/src/Parsing/TagParser.php:44

Fixes: For HTML2PDF < 5.x (html2pdf.class.php)

/**
* tag : script
* mode : OPEN
*
* @param  array $param
* @return boolean
*/
protected function _tag_open_Script($param)
{
return $this->_tag_open_B($param, 'script');
}

/**
* tag : script
* mode : CLOSE
*
* @param  array $param
* @return boolean
*/
protected function _tag_close_script($param)
{
return $this->_tag_close_B($param);
}

MySQL Error Code 1215: “Cannot add foreign key constraint”

Why am I unable to create a constraint? The error message doesn’t help much. You just get the following line when you run this SQL statement:

ALTER TABLE user_class ADD FOREIGN KEY (user_id) REFERENCES user(id);

Error Code: 1215
Cannot add foreign key constraint

If you try running some of these SQL statements from mysql ( https://dev.mysql.com/doc/refman/5.6/en/create-table-foreign-keys.html#foreign-keys-adding ), still same error occurred without a reason. You may have to double check a few things within related tables and their fields.

1) The table or index the constraint refers to does not exist yet (usual when loading sql dumps).

2) The table or index in the constraint references misuses quotes.

3) The local key, foreign table or column in the constraint references have a typo.

4) The column the constraint refers to is not of the same type or width as the foreign column

5) The foreign object is not a KEY of any kind

6) The foreign key is a multi-column PK or UK, where the referenced column is not the leftmost one

7) Different charsets/collations among the two table/columns

8) Must be InnoDB

9) Using syntax shorthands to reference the foreign key

10) Using SET DEFAULT for a constraint action


Difference between Java Servlet and JSP

Servlet is html in java whereas JSP is java in html. Servlets run faster compared to JSP. … JSP is a webpage scripting language that can generate dynamic content while Servlets are Java programs that are already compiled which also creates dynamic web content. In MVC, jsp acts as a view and servlet acts as a controller.

Servlet example: Hello.java

response.setContentType("text/html");
    PrintWriter writer = response.getWriter();
    
    writer.println("<html>");
    writer.println("<head>");
    writer.println("<title>This is my .java file to .class file. Sample Application Servlet Page</title>");
    writer.println("</head>");
    writer.println("<body bgcolor=white>");
    
    writer.println("<table border=\"0\">");
    writer.println("<tr>");
    writer.println("<td>");
    writer.println("<img src=\"images/tomcat.gif\">");
    writer.println("</td>");
    writer.println("<td>");
    writer.println("<h1>Sample Application Servlet</h1>");
    writer.println("This is the output of a servlet that is part of");
    writer.println("the Hello, World application.");
    writer.println("</td>");
    writer.println("</tr>");
    writer.println("</table>");

JSP example: hello.jsp

<table border="0">
<tr>
<td align=center>
<img src="images/tomcat.gif">
</td>
<td>
<h1><%= new String("Sample Application JSP Page") %></h1>
This is the output of a JSP page that is part of the Hello, World
application.
</td>
</tr>
</table>