Posts

one to many : product has many quantites | get Data by quantity using product id

 public interface CreateQuantityRepo extends JpaRepository<CreateQuantity, Long> { @Query("from CreateQuantity as d where d.createProduct.id=:createProductId") public List<CreateQuantity> getByIdCreateQuantity(@Param("createProductId") long createProductId); }

one to many jpa : one product have many Quantity

product.java  @OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY,mappedBy = "createProduct") private List<CreateQuantity> quantities; Quantity.java @ManyToOne @JoinColumn(name="productID") private CreateProduct createProduct;

search bar on top navbar html css javascript

 <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <style> * {box-sizing: border-box;} body {   margin: 0;   font-family: Arial, Helvetica, sans-serif; } .topnav {   overflow: hidden;   background-color: #e9e9e9; } .topnav a {   float: left;   display: block;   color: black;   text-align: center;   padding: 14px 16px;   text-decoration: none;   font-size: 17px; } .topnav a:hover {   background-color: #ddd;   color: black; } .topnav a.active {   background-color: #2196F3;   color: white; } .topnav .search-container {   float: right; } .topnav input[type=text] {   padding: 6px;   margin-top: 8px;   font-size: 17px;   border: none; } .topnav .search-container button {   float: right;   padding: 6px 10px;   margin-top: 8px;   margin-right: 16px; ...

top Navigation html css javascript

 <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <style> body {   margin: 0;   font-family: Arial, Helvetica, sans-serif; } .topnav {   overflow: hidden;   background-color: #333; } .topnav a {   float: left;   display: block;   color: #f2f2f2;   text-align: center;   padding: 14px 16px;   text-decoration: none;   font-size: 17px; } .topnav a:hover {   background-color: #ddd;   color: black; } .topnav a.active {   background-color: #04AA6D;   color: white; } .topnav .icon {   display: none; } @media screen and (max-width: 600px) {   .topnav a:not(:first-child) {display: none;}   .topnav a.icon {     float: right;     display: block;   } } @media screen and (max-width: 600...

password hide and show data

 <!DOCTYPE html> <html> <body> <p>Click the radio button to toggle between password visibility:</p> Password: <input type="password" value="FakePSW" id="myInput"><br><br> <input type="checkbox" onclick="myFunction()">Show Password <script> function myFunction() {   var x = document.getElementById("myInput");   if (x.type === "password") {     x.type = "text";   } else {     x.type = "password";   } } </script> </body> </html>

Table in Html css

 <!DOCTYPE html> <html> <head> <style> * {   box-sizing: border-box; } .row {   margin-left:-5px;   margin-right:-5px; }    .column {   float: left;   width: 50%;   padding: 5px; } /* Clearfix (clear floats) */ .row::after {   content: "";   clear: both;   display: table; } table {   border-collapse: collapse;   border-spacing: 0;   width: 100%;   border: 1px solid #ddd; } th, td {   text-align: left;   padding: 16px; } tr:nth-child(even) {   background-color: #f2f2f2; } </style> </head> <body> <h2>Tables Side by Side</h2> <p>How to create side-by-side tables with CSS:</p> <div class="row">   <div class="column">     <table>       <tr>         <th>First Name</th>         <th>Last Name</th>       ...

thymeleaf including fragements | thymeleaf page add | thymeleaf parts add

-: including fragments  :-  footer.html <footer th:fragement="footer1"> ............................................... </footer> <footer th:fragement="footer2"> ............................................... </footer> <footer th:fragement="footer3"> ............................................... </footer> index.html <footer th:replace="footer::footer1"> ......................................................... </footer>

security session tags

Anonymous person <div sec:authorize="isAnonymous()">  </div> Authenticated person <div sec:authorize="isAuthenticated()"> </div> showing Authenticated person name : <span sec:authentication="name">username</span>

convert HTML to thymeleaf Tags Add

 <!DOCTYPE html>         to <html lang="en" xmlns:th="http://www.thymeleaf.org"> -------------------------------------------------------------------------------------------- BASE.HTML <html lang="en" xmlns:th="http://www.thymeleaf.org" th:fragment="layout(content)"  xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity5"> <div th:replace="${content}" class="main">   example.html <html lang="en" xmlns:th="http://www.thymeleaf.org" th:replace="(~{base::layout(~{::section})})"  xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity5"  > <section> ................................................................ </section> -----------------------------------------------------------------------------------------------

javaScript Regex Expression

 javaScript Regex Expression  A regular expression is a  pattern  of characters. The pattern is used to do pattern-matching  "search-and-replace"  functions on text. Syntax / pattern / modifier(s) ; Modifiers Modifiers are used to perform case-insensitive and global searches: Modifier Description g Perform a global match (find all matches rather than stopping after the first match) i Perform case-insensitive matching m Perform multiline matching      <p id="demo"></p> <script> let text = "Visit W3Schools"; let pattern = /w3schools/i; let result = text.match(pattern); document.getElementById("demo").innerHTML = result; </script> o/p :-  W3Schools Brackets Brackets are used to find a range of characters: Expression Description [abc] Find any character between the brackets [^abc] Find any character NOT between the brackets [0-9] Find any character between the brackets (any digit) [^0-9] Find any character NOT between...

Circel Rounding Animation

 Circel Rounding Animation <div class="main">   <div class="circle"></div> </div> -------------------------------------------- body{   background:black; } .main{   width:330px;   height:330px;   border:1px solid #CCC;   position:absolute;   top:0; bottom:0; left:0;right:0;   margin:auto;   border-radius:50%;    border:10px solid white; } .circle{   width:10px;   height:10px;   background:cyan;   border-radius:50%;   position:absolute;   top:0; bottom:0; left:0;right:0;   overflow:hidden;   margin:auto;   animation: circle 2s linear infinite; } @keyframes circle{   0%{     transform:rotate(0deg)               translate(-165px)               rotate(0deg);      }   100%{     transform:rotate(360deg)               tr...

allowing input only for float number & Number

allowing input only for float number & Number  $( 'input.float' ). on ( 'input' , function ( ) { this . value = this . value . replace ( /[^0-9.]/g , '' ). replace ( /(\..*?)\..*/g , '$1' ); }); < script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js" > </ script > < input type = "text" class = "float" /> Another, < script src = "https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" > </ script > < script src = "https://cdnjs.cloudflare.com/ajax/libs/caret/1.0.0/jquery.caret.min.js" > </ script > < input type = "text" class = "filterme" > $( '.filterme' ). keypress ( function ( eve ) { if ((eve. which != 46 || $( this ). val (). indexOf ( '.' ) != - 1 ) && (eve. which < 48 || eve. which > 57 ) || (eve. which == 46 && $( this ). caret ()....

One To One Query in JPA springboot

 One To One Query in JPA springboot In JPA and Spring Boot, you can perform a one-to-one query using JPQL (Java Persistence Query Language) or by using Spring Data JPA's query methods. Assuming you have two entities, let's call them EntityA and EntityB, with a one-to-one relationship between them, you can write a JPQL query to retrieve EntityA and its associated EntityB as follows: @Entity public class EntityA { @Id private Long id; @OneToOne(mappedBy = "entityA") private EntityB entityB; // ... } @Entity public class EntityB { @Id private Long id; @OneToOne @JoinColumn(name = "entity_a_id") private EntityA entityA; // ... } ------------------------------------------------------------------------------ TypedQuery<EntityA> query = entityManager.createQuery(     "SELECT a FROM EntityA a JOIN FETCH a.entityB b WHERE a.id = :id", EntityA.class); query.setParameter("id", entityId); EntityA e...