<!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org" lang="en"> <head>…
- User
<link th:href="@{/static/css/bootstrap-5.3.3.min.css}" rel="stylesheet" /> <link th:href="@{/static/css/font-awesome-4.7.0.min.css}" rel="stylesheet" /> <link th:href="@{/static/css/esign-toast.css}" rel="stylesheet" /> <script th:src="@{/static/js/jquery-3.7.1.min.js}" type="text/javascript"></script> <script th:src="@{/static/js/esign-toast.js}" type="text/javascript"></script> <script th:src="@{/static/webViewer/lib/webviewer.min.js}" type="text/javascript"></script> <script th:src="@{/static/js/bootstrap-5.3.3.min.js}" type="text/javascript"></script> <script th:inline="javascript"> var contextRoot = /*[[@{/}]]*/ '';</script> <script th:src="@{/static/js/viewer.js}" type="text/javascript"></script> <style> #pdfViewer { width: 100vh; } .alert { padding: 5px 10px !important; } .eSignLoadingSpinner { background: rgba(0, 0, 0, 0.1) no-repeat scroll center center; display: none; height: 100%; left: 0; position: fixed; top: 0; width: 100%; z-index: 999; text-align: center; } .eSignLoadingSpinner i { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } .declined-document-modal-backdrop { position: fixed; top: 0; left: 0; z-index: 1055; width: 100vw; height: 100vh; background-color: #000; } .declined-document-modal-backdrop.show { opacity: .5; } </style><!--Loading Spinner--> <div class="eSignLoadingSpinner" style="display: none;z-index:9999999999"><i class="fa fa-spinner fa-spin fa-2x"></i></div> <!-- Hidden input to store the isValidUrl value --> <input type="hidden" id="isValidUrl" th:value="${isValidUrl}" /> <input type="hidden" id="pdfDetails" th:value="${pdfDetails}" /> <input type="hidden" id="uniqueURL" th:value="${uniqueURL}" /> <input type="hidden" id="isLocked" th:value="${isLocked}" /> <input type="hidden" id="licenseKey" th:value="${licenseKey}" /> <div class="modal fade" id="pdfViewerModal" tabindex="-1" aria-labelledby="pdfViewerModalLabel" aria-hidden="true"> <div class="modal-dialog modal-fullscreen"> <div class="modal-content"> <div class="modal-header"> <h1 class="modal-title fs-5" id="pdfViewerModalLabel"></h1> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <div class="alert alert-info" style="display: flex;margin-bottom: 10px;" id="finishDocumentDiv" th:if='${!recipientStatus.equals("Completed") and !documentStatus.equals("Voided") and !documentStatus.equals("Expired")}'> <span style="font-size: 14px;margin-top: 4px;font-weight: 600;">Please Review & Act on These Documents</span> <div style="margin-left: auto"> <button class="btn btn-sm btn-danger" id="declineButton" disabled><i class='fa fa-ban' aria-hidden='true'></i> Decline</button> <button class="btn btn-sm btn-primary" id="finishButton" disabled><i class='fa fa-floppy-o' aria-hidden='true'></i> Finish Document</button> </div> </div> <div id="pdfViewer" style="width: 100%;"></div> </div> </div> </div> </div> <!--Declined Popup--> <div class="modal fade" id="declinedDocumentModal" tabindex="-1" aria-labelledby="declinedDocumentModalLabel" aria-hidden="true" style="z-index: 1060"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h1 class="modal-title fs-6" id="declinedDocumentModalLabel">Are you sure you want to decline document?</h1> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <div class="declined_reason_main_container" style="display: flex;padding: 10px;justify-content: center;flex-direction: column;gap: 20px;"> <div class="actual_reason_div" style="display: flex;width: 100%;"> <span style="display: flex;gap: 5px;padding: 5px;border: 1px solid;border-radius: 10px;width: 100%;background: white;align-items: center;"> <textarea class="form-control" name="reason_for_void" id="reason_for_void" placeholder="Add Reason" rows="5" autocomplete="off"></textarea> </span> </div> <span>Note : If you Decline this document then status of this document will be marked as Void.</span> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-sm btn-secondary" data-bs-dismiss="modal"><i class="fa fa-times" style="margin-right: 3px;"></i>No</button> <button type="button" class="btn btn-sm btn-success" id="declinedConfirmationButton"><i class="fa fa-check-square-o" style="margin-right: 3px;"></i>Yes</button> </div> </div> </div> </div> <!--Custom Modal BackDrop --> <div class="declined-document-modal-backdrop fade" style="display: none"></div> <!--View Next Document Popup--> <div class="modal fade" id="nextDocumentModal" tabindex="-1" aria-labelledby="nextDocumentModalLabel" aria-hidden="true" style="z-index: 1060"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h1 class="modal-title fs-5" id="nextDocumentModalLabel">You're Done! Want To Sign Another Document?</h1> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <div class="row p-2"> <div class="col-sm-12"> <div class="row mb-3"> <label class="col-md-4 fw-semibold">Name</label> <span class="col-md-8" id="documentName"></span> </div> <div class="row mb-3"> <label class="col-md-4 fw-semibold">Description</label> <span class="col-md-8 text-break" id="documentDescription"></span> </div> <div class="row mb-3"> <label class="col-md-4 fw-semibold">File Name</label> <span class="col-md-8" id="documentFileName"></span> </div> <div class="row mb-3"> <label class="col-md-4 fw-semibold">Creator Name</label> <span class="col-md-8" id="documentCreatorName"></span> </div> <div class="row mb-3"> <label class="col-md-4 fw-semibold">Expiry Date</label> <span class="col-md-8 text-danger" id="documentExpiryDate"></span> </div> <div class="row mb-3"> <label class="col-md-4 fw-semibold">Sent On</label> <span class="col-md-8" id="documentSentOn"></span> </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-sm btn-success" id="signNextDocumentButton">Sign Next Document <i class="fa fa-arrow-circle-right" style="margin-left: 3px;"></i></button> <button type="button" class="btn btn-sm btn-secondary" data-bs-dismiss="modal"><i class="fa fa-times" style="margin-right: 3px;"></i>No Thanks</button> </div> </div> </div> </div>Can you make this as mobile freidly also
- Assistant
To make your HTML document more mobile-friendly, we can add responsive design practices using Bootstrap classes along with some additional CSS adjustments. Here are some steps to enhance the responsiveness of your layout:
-
Add the viewport meta tag: Make sure you include a viewport meta tag in the head section to control the layout on mobile browsers.
-
Use Bootstrap's Responsive Classes: Utilize Bootstrap's grid system to make sure the layout adjusts appropriately based on the screen size.
-
Adjust Styles: Modify any fixed-width styles to use percentages or viewport units to ensure proper scaling.
-
Test Modal Sizes: Use Bootstrap modals in a way that they fit well on smaller screens.
Here is your updated HTML code with mobile-friendly adjustments:
<!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org" lang="en"> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>eSign</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link th:href="@{/static/css/bootstrap-5.3.3.min.css}" rel="stylesheet" /> <link th:href="@{/static/css/font-awesome-4.7.0.min.css}" rel="stylesheet" /> <link th:href="@{/static/css/esign-toast.css}" rel="stylesheet" /> <script th:src="@{/static/js/jquery-3.7.1.min.js}" type="text/javascript"></script> <script th:src="@{/static/js/esign-toast.js}" type="text/javascript"></script> <script th:src="@{/static/webViewer/lib/webviewer.min.js}" type="text/javascript"></script> <script th:src="@{/static/js/bootstrap-5.3.3.min.js}" type="text/javascript"></script> <script th:inline="javascript"> var contextRoot = /*[[@{/}]]*/ '';</script> <script th:src="@{/static/js/viewer.js}" type="text/javascript"></script> <style> #pdfViewer { width: 100%; height: 60vh; /* Ensure it takes a responsive height */ min-height: 400px; /* Minimum height for better visibility */ } .alert { padding: 5px 10px !important; } .eSignLoadingSpinner { background: rgba(0, 0, 0, 0.1) no-repeat scroll center center; display: none; height: 100%; left: 0; position: fixed; top: 0; width: 100%; z-index: 999; text-align: center; } .eSignLoadingSpinner i { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } .declined-document-modal-backdrop { position: fixed; top: 0; left: 0; z-index: 1055; width: 100vw; height: 100vh; background-color: #000; } .declined-document-modal-backdrop.show { opacity: .5; } </style> </head> <body style="margin: 0"> <!--Loading Spinner--> <div class="eSignLoadingSpinner" style="display: none;"><i class="fa fa-spinner fa-spin fa-2x"></i></div> <!-- Hidden input to store the isValidUrl value --> <input type="hidden" id="isValidUrl" th:value="${isValidUrl}" /> <input type="hidden" id="pdfDetails" th:value="${pdfDetails}" /> <input type="hidden" id="uniqueURL" th:value="${uniqueURL}" /> <input type="hidden" id="isLocked" th:value="${isLocked}" /> <input type="hidden" id="licenseKey" th:value="${licenseKey}" /> <!-- PDF Viewer Modal --> <div class="modal fade" id="pdfViewerModal" tabindex="-1" aria-labelledby="pdfViewerModalLabel" aria-hidden="true"> <div class="modal-dialog modal-fullscreen"> <div class="modal-content"> <div class="modal-header"> <h1 class="modal-title fs-5" id="pdfViewerModalLabel"></h1> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <div class="alert alert-info" style="display: flex;margin-bottom: 10px;" id="finishDocumentDiv" th:if='${!recipientStatus.equals("Completed") and !documentStatus.equals("Voided") and !documentStatus.equals("Expired")}'> <span style="font-size: 14px;margin-top: 4px;font-weight: 600;">Please Review & Act on These Documents</span> <div style="margin-left: auto"> <button class="btn btn-sm btn-danger" id="declineButton" disabled><i class='fa fa-ban' aria-hidden='true'></i> Decline</button> <button class="btn btn-sm btn-primary" id="finishButton" disabled><i class='fa fa-floppy-o' aria-hidden='true'></i> Finish Document</button> </div> </div> <div id="pdfViewer"></div> </div> </div> </div> </div> <!--Declined Popup--> <div class="modal fade" id="declinedDocumentModal" tabindex="-1" aria-labelledby="declinedDocumentModalLabel" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h1 class="modal-title fs-6" id="declinedDocumentModalLabel">Are you sure you want to decline document?</h1> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <div class="declined_reason_main_container" style="display: flex; padding: 10px; justify-content: center; flex-direction: column; gap: 20px;"> <div class="actual_reason_div" style="display: flex; width: 100%;"> <textarea class="form-control" name="reason_for_void" id="reason_for_void" placeholder="Add Reason" rows="5" autocomplete="off"></textarea> </div> <span>Note: If you decline this document, its status will be marked as Void.</span> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-sm btn-secondary" data-bs-dismiss="modal">No</button> <button type="button" class="btn btn-sm btn-success" id="declinedConfirmationButton">Yes</button> </div> </div> </div> </div> <!-- View Next Document Popup --> <div class="modal fade" id="nextDocumentModal" tabindex="-1" aria-labelledby="nextDocumentModalLabel" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h1 class="modal-title fs-5" id="nextDocumentModalLabel">You're Done! Want To Sign Another Document?</h1> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <div class="row p-2"> <div class="col-12"> <div class="row mb-3"> <label class="col-sm-4 fw-semibold">Name</label> <span class="col-sm-8" id="documentName"></span> </div> <div class="row mb-3"> <label class="col-sm-4 fw-semibold">Description</label> <span class="col-sm-8 text-break" id="documentDescription"></span> </div> <div class="row mb-3"> <label class="col-sm-4 fw-semibold">File Name</label> <span class="col-sm-8" id="documentFileName"></span> </div> <div class="row mb-3"> <label class="col-sm-4 fw-semibold">Creator Name</label> <span class="col-sm-8" id="documentCreatorName"></span> </div> <div class="row mb-3"> <label class="col-sm-4 fw-semibold">Expiry Date</label> <span class="col-sm-8 text-danger" id="documentExpiryDate"></span> </div> <div class="row mb-3"> <label class="col-sm-4 fw-semibold">Sent On</label> <span class="col-sm-8" id="documentSentOn"></span> </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-sm btn-success" id="signNextDocumentButton">Sign Next Document</button> <button type="button" class="btn btn-sm btn-secondary" data-bs-dismiss="modal">No Thanks</button> </div> </div> </div> </div> </body> </html>Key Changes:
- Viewport Meta Tag: Added to ensure that the layout scales correctly on various devices.
- Responsive Widths: Replaced fixed widths with percentages and improved heights for the PDF viewer.
- Flexbox on Modals: Improved modal behavior to ensure elements stack nicely on smaller screens.
These adjustments will help ensure that the webpage is more mobile-responsive and user-friendly on smaller screens. Remember to test it on various devices to fine-tune the design further as necessary.
-
- User
can we make custom error page throws if path not found
- Assistant
To implement a custom error page for "404 Not Found" in a web application, you generally follow these steps:
-
Create a Custom Error Page: You'll need to create an HTML page that will serve as your custom error page.
-
Configure Your Web Server/Application: Depending on whether you're using a web framework (like Spring, Django, etc.) or a plain web server (like Apache, Nginx, etc.), you'll set up your server to redirect to your custom error page when a user accesses a non-existent path.
Here’s how you can do this in different scenarios:
1. Custom Error Page in a Spring Boot Application
If you're using Spring Boot, here's how to configure a custom 404 error page:
Step 1: Create an HTML file for your custom error page.
Create a file named
error.htmlin your templates folder (if using Thymeleaf) or in the static folder (for static serving). Here's a simple example:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>404 Not Found</title> <link rel="stylesheet" href="/static/css/bootstrap-5.3.3.min.css"> </head> <body class="text-center"> <div class="container"> <h1 class="mt-5">404 Not Found</h1> <p class="lead">Sorry, the page you are looking for does not exist.</p> <a href="/" class="btn btn-primary">Go to Homepage</a> </div> </body> </html>Step 2: Configure Spring Boot to use the error page.
In your
application.propertiesorapplication.yml, set the following:server.error.whitelabel.enabled=falseThis setting will disable the default Spring Boot error page, allowing you to use your custom error page instead.
Step 3: If you want to specify your error page programmatically (optional), you can create a controller:
import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class ErrorController { @RequestMapping("/error") public String handleError() { // Return the name of your error view (without the .html) return "error"; } }2. Custom Error Page in a Traditional Web Server (Apache or Nginx)
For Apache:
Edit your
.htaccessfile orhttpd.conffile to include the following:ErrorDocument 404 /path-to-your-custom-error-page.htmlReplace
/path-to-your-custom-error-page.htmlwith the actual path to your custom error page.For Nginx:
Edit your server block in the Nginx configuration file:
error_page 404 /404.html; location = /404.html { root /path/to/your/error/page; internal; }3. Testing the Custom Error Page
- After setting it up, try to access a non-existing URL in your web application or site.
- It should redirect you to your custom 404 error page with the message that the page is not found.
Summary
Creating a custom error page improves the user experience by providing informative feedback when they encounter a broken link or a missing resource. By following these steps, you should be able to implement a 404 error page that fits seamlessly into your application's design.
-
- User
Whether a "NoHandlerFoundException" should be thrown if no Handler was found to process a request. @deprecated since 3.2.0 for removal in 3.4.0 Deprecated DispatcherServlet property is deprecated for removal and should no longer need to be configured Can you please provide alternative
- Assistant
In Spring Framework, starting from version 3.2.0, the
NoHandlerFoundExceptionis deprecated for removal in a future version (3.4.0). This means that you should now consider alternative approaches for handling requests that do not match any handlers in your Spring application.Here's how to handle this situation using
@ControllerAdviceand a customized error handling approach:Alternative Approach: Using
@ControllerAdviceInstead of relying on
NoHandlerFoundException, you can leverage@ControllerAdvicealong with Spring's@ExceptionHandlerto create a global error handler. Here's how you can implement it:-
Create a Custom Error Page: First, make a custom error page for the "404 Not Found".
For example, create an
error.htmlfile in your templates directory:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>404 Not Found</title> <link rel="stylesheet" href="/static/css/bootstrap-5.3.3.min.css"> </head> <body class="text-center"> <div class="container"> <h1 class="mt-5">404 Not Found</h1> <p class="lead">Sorry, the page you are looking for does not exist.</p> <a href="/" class="btn btn-primary">Go to Homepage</a> </div> </body> </html> -
Configure Spring to Not Show Whitelabel Error Page: In your
application.propertiesorapplication.yml, disable the Whitelabel error page:server.error.whitelabel.enabled=false -
Global Exception Handling with
@ControllerAdvice:Create a new class for global exception handling:
import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.servlet.NoHandlerFoundException; import org.springframework.http.HttpStatus; @ControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(NoHandlerFoundException.class) @ResponseStatus(HttpStatus.NOT_FOUND) public String handleNoHandlerFoundException(NoHandlerFoundException ex, Model model) { model.addAttribute("error", "404 Not Found"); model.addAttribute("message", "Sorry, the page you are looking for does not exist."); return "error"; // Return the name of the error view (e.g., error.html) } // You can add more exception handlers for different types of exceptions }
Explanation:
-
ControllerAdvice:
@ControllerAdviceallows you to handle exceptions across the whole application in one global handling component. -
Exception Handling Method: The method
handleNoHandlerFoundExceptioncapturesNoHandlerFoundException. You set the response status to 404 and customize the model for the error view.
Conclusion
With this approach, you no longer rely on the deprecated
NoHandlerFoundExceptionproperty but instead handle unmatched requests with a global error handler. This way, it's easier to maintain and offers a more structured way to manage errors across your application. This also aligns with best practices in Spring and makes your application more resilient and user-friendly in handling erroneous URLs. -