Skip to main content

Posts

Create NEW APP WITH FORM ELEMENT in DJANGO

1) Create New App For Si       python manage.py startapp siapp 2)  Create urls.py under app:- from django.urls import path from . import views urlpatterns = [     path('', views.index, name='index'),  ] 3) Create templates folder under app and subfolder using  appname and create .html     design form element using Html    <form action="silogic"  method="get">     ...   </form>   4)  edit app url and define logic method     from django.urls import path from . import views urlpatterns = [     path('', views.index, name='index'),      path('silogic', views.silogic, name='silogic'),  ] 5  define views.py two method first for load and second for action      def index(request):        return render(request,"appname/htmlfilename")    def silogic(reque...

Create Design in Servlet using HTML and Css,How to write HTML and CSS Code in Servlet

It means Hypertext markup language that is used to design the user interface of a Web application for all web technology. HTML has predefined elements and attributes to design a web page:- <html> <head> </head> <body> </body> </html> CSS:-   it means a cascading style sheet, it is used to provide properties to design an attractive HTML web page,, for example, if we want to color, font, size, margin, padding, position, shape then we use CSS. Addition Program for Servlet:- package scs; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/Addition") public class Addition extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ...

Create Login Script using Selenium IDE manually?

To Create Selenium IDE TEST SCRIPT first we Open Selenium IDE and Enter the Base URL of LIVE Application. Open:-  It is used to open SITE using URL Command                                     Target                                                           value open                                             /customer/login Type:-  It is used to type content in text field type                                           name = customerEmail                     ...

What is WebDriver, WebDriver Command

What is Web Driver:- It is the most important component of Selenium, which is used to create scripts using Java, C#, PYTHON, etc to test web applications. Web drivers provide better customization and advanced testing operations on Web applications. It also uses a locator, command to create an automation test script. Web driver script can be executed in all standard Web browsers using Web browser Client-based software.  How to create infrastructure for Web Driver under selenium:- 1)  Install Java and Eclipse Software 2)  Download Selenium to manage Web Driver     https://www.selenium.dev/downloads/ 3)  Download Browser Client to run the script for all particular browsers.     https://www.selenium.dev/downloads/ 4) Open eclipse and create Java Project 5) Add Selenium Webdriver Jar file under project   Right click on project ----> Properties ----> Java Build Path ---- > Click on library ---> Add External JAR ---->  Then press...

How to create single method to load template and write code?

  Django provides a single view method to render the template using the GET method and POST method to write code after form submission. It is the standard approach to write Django Code. Syntax to write load template and logic using a single file. def Methodname(request):          if request.method=="POST":                  Write Business Code                   return render(request,"appname/filename",{'key':output})       return render(request,"appname/filename") Now I am explaining the example of the SI Calculation App? Step1st:-   Create APP using   python manage.py startapp siapp Step2nd:-   go into settings.py and enter appname Step3rd:-  go to project urls.py and create app urls step4th:-  create urls.py under app and define method urls from django.urls import path from . import views urlpatterns=[ path('...

What is Difference between GET Method and Post Method in Django Form?

1)  GET METHOD:-    It is used to submit the data of form elements into a web server using URL parameters, GET method call the HttpGet object to send data from form to web server. all data will be shown on the  URL hence get is not secure and we can send limited data using GET Method. default URL method is GET means when we hit any web URL under web browser then it will be called using the GET method. 2)  POST Method:-  It is used to submit the data of form elements into a web server using the HttpPost object.it sends data internally then data will not be shown on URL parameters hence it provides better security as compared to the get method, we can send unlimited data using the Post method hence we often prefer the post method to send data from client machine to server machine. Django uses csrf_token to send data using the POST method csrf_token will generate a token key from the browser to match from the server. CSRF means   cross-site reque...

How to create form using POST Method

POST is the most secure and reliable method to send data from client machines to server machines hence we should always use the POST method to create form elements. Django provides the CSRF option to send data using the POST method. CSRF means Cross-site request forgery . it will protect invalid requests under the webserver to check the security token. If the security token is valid then the server will process requests otherwise deny the request. Now we are creating a calculation of simple interest using the POST method. Step1st:-   Create an app if not exist, create urls.py to define method if not created. urls.py from django.urls import path from . import views urlpatterns=[   path('',views.index,name='index'),   path('home',views.index,name='index')   ] Step2nd:-    Create templates/appname/filename to design template create index.html <!DOCTYPE html> <html> <head> <title></title> <link href="/static/style.css...