TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Sunday, 26 April 2020

JSP Scriptlet Tag In Java | Define The JSP Scriptlet Tag In Java | JSP Scriptlet Tag In Java In Java In Hindi

JSP Scriptlet tag 

In JSP, java code can be written inside the jsp page using the scriptlet tag. see what are the scripting elements first.

JSP Scripting elements


The scripting elements provides the ability to insert java code inside the jsp. There are three types of scripting elements:
  • scriptlet tag
  • expression tag
  • declaration tag
download image of scriptlet tag in jsp

 Fig :JSP Scriptlet Tag 


JSP scriptlet tag

A scriptlet tag is used to execute java source code in JSP. 

Syntax is as follows:    

     <%  java source code %>  


Example of JSP scriptlet tag


    <html>  

    <body>  
    <% out.print("welcome to jsp"); %>  
    </body>  
    </html>  

    Example of JSP scriptlet tag that prints the user name


we have created two files index.html and welcome.jsp. The index.html file gets the username from the user and the welcome.jsp file prints the username with the welcome message.


File: index.html

     <html>  
     <body>  
     <form action="welcome.jsp">  
   <input type="text" name="uname">  
   <input type="submit" value="go"><br/>  
    </form>  
    </body>  
    </html>  



File: welcome.jsp

     <html>  
    <body>  
    <%  
     String name=request.getParameter("uname");  
     out.print("welcome "+name);   
      %>  
    </form>  
    </body>  
    </html>  


No comments:

Post a Comment