search

JSTL应用2

Jun 07, 2016 pm 03:07 PM
testvarvariableapplicationconditionexpression

第一种: c:if test=条件表达式 var=变量名 scope=范围/ 第二种: c:if test=条件表达式 var=变量名 scope=范围 程序体 /c:if test如果等于true那么执行代码 如果不等于true 那么不执行 var 是一个 bool型的变量用于保存 条件结果 scope是一个取的范围 下面是

第一种:  

            

 第二种: 

程序体

 

test如果等于"true"那么执行代码  如果不等于true 那么不执行     

var 是一个 bool型的变量用于保存 条件结果 

scope是一个取值的范围  

下面是一个简单使用代码:


http://java.sun.com/jsp/jstl/core" prefix="c" %>


Insert title here






 


       //对test进行赋值的时候 一定要把表达式结果转换为 字符串 
   代码段  

  
  
   代码段
  

 

实例代码


http://java.sun.com/jsp/jstl/core" prefix="c" %>


Insert title here



  
  
  

  
  
  



                                                        以及实现了 java.util.Map接口的 键值对 

                                                         或者数组  

 

 第一种:

是迭代集合或者键值对  对于迭代次数未知

程序体。。。。。

 

 

varStatus 有四个属性  

first 是否是第一个元素

last 是否是最后一个元素

count  当前迭代的次数 

index表示 当前元素的下标

 

第二种:

    //这个类似于 for循环

循环体 

 

第二种比较简单因此我只写出迭代 实例:


http://java.sun.com/jsp/jstl/core" prefix="c" %>


Insert title here


   String []name={"one","two","three","four","five"}; 
   request.setAttribute("name", name); //java中数组也是引用数据类型
%>



第一个元素



最后一个元素





 

4、

  可以用来迭代一个字符串 这个字符串有个特点 被多个符号分割开来  

用法和 类似

[step="步长"]    [varStatus="迭代状态变量这里和上面的一样"]>

 

下面是简单的例子


http://java.sun.com/jsp/jstl/core" prefix="c" %>


Insert title here


  String str="张三|李四|王五|马六";
  request.setAttribute("strName", str);
%>




 

 

等子程序


http://java.sun.com/jsp/jstl/core" prefix="c" %>


Insert title here


>

 

6、   不带参数的页面跳转我们可以这样使用

点击去首页

如果带参数那么 就需要有body 


 

相比之下我们可以看到 第二个产生的url是   index.jsp;jsessionid=C1C2E5EAE9F2797E44971A409A1F01D5?param=%b2%ce%ca%fd  带上一个参数 

第一个不带参数的url是 idnex.jsp

 

7、      当一个请求到来的时候会自动跳转到指定网页  和  response.sendRedirect(String  url); 类似

       

     

 

   

加入页面时  http://www.baidu.com那么 之后的参数就是

http://www.baidu.com/?param1=555

 
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
MySQL BLOB : are there any limits?MySQL BLOB : are there any limits?May 08, 2025 am 12:22 AM

MySQLBLOBshavelimits:TINYBLOB(255bytes),BLOB(65,535bytes),MEDIUMBLOB(16,777,215bytes),andLONGBLOB(4,294,967,295bytes).TouseBLOBseffectively:1)ConsiderperformanceimpactsandstorelargeBLOBsexternally;2)Managebackupsandreplicationcarefully;3)Usepathsinst

MySQL : What are the best tools to automate users creation?MySQL : What are the best tools to automate users creation?May 08, 2025 am 12:22 AM

The best tools and technologies for automating the creation of users in MySQL include: 1. MySQLWorkbench, suitable for small to medium-sized environments, easy to use but high resource consumption; 2. Ansible, suitable for multi-server environments, simple but steep learning curve; 3. Custom Python scripts, flexible but need to ensure script security; 4. Puppet and Chef, suitable for large-scale environments, complex but scalable. Scale, learning curve and integration needs should be considered when choosing.

MySQL: Can I search inside a blob?MySQL: Can I search inside a blob?May 08, 2025 am 12:20 AM

Yes,youcansearchinsideaBLOBinMySQLusingspecifictechniques.1)ConverttheBLOBtoaUTF-8stringwithCONVERTfunctionandsearchusingLIKE.2)ForcompressedBLOBs,useUNCOMPRESSbeforeconversion.3)Considerperformanceimpactsanddataencoding.4)Forcomplexdata,externalproc

MySQL String Data Types: A Comprehensive GuideMySQL String Data Types: A Comprehensive GuideMay 08, 2025 am 12:14 AM

MySQLoffersvariousstringdatatypes:1)CHARforfixed-lengthstrings,idealforconsistentlengthdatalikecountrycodes;2)VARCHARforvariable-lengthstrings,suitableforfieldslikenames;3)TEXTtypesforlargertext,goodforblogpostsbutcanimpactperformance;4)BINARYandVARB

Mastering MySQL BLOBs: A Step-by-Step TutorialMastering MySQL BLOBs: A Step-by-Step TutorialMay 08, 2025 am 12:01 AM

TomasterMySQLBLOBs,followthesesteps:1)ChoosetheappropriateBLOBtype(TINYBLOB,BLOB,MEDIUMBLOB,LONGBLOB)basedondatasize.2)InsertdatausingLOAD_FILEforefficiency.3)Storefilereferencesinsteadoffilestoimproveperformance.4)UseDUMPFILEtoretrieveandsaveBLOBsco

BLOB Data Type in MySQL: A Detailed Overview for DevelopersBLOB Data Type in MySQL: A Detailed Overview for DevelopersMay 07, 2025 pm 05:41 PM

BlobdatatypesinmysqlareusedforvoringLargebinarydatalikeImagesoraudio.1) Useblobtypes (tinyblobtolongblob) Basedondatasizeneeds. 2) Storeblobsin Perplate Petooptimize Performance.3) ConsidersxterNal Storage Forel Blob Romana DatabasesizerIndimprovebackupupe

How to Add Users to MySQL from the Command LineHow to Add Users to MySQL from the Command LineMay 07, 2025 pm 05:01 PM

ToadduserstoMySQLfromthecommandline,loginasroot,thenuseCREATEUSER'username'@'host'IDENTIFIEDBY'password';tocreateanewuser.GrantpermissionswithGRANTALLPRIVILEGESONdatabase.*TO'username'@'host';anduseFLUSHPRIVILEGES;toapplychanges.Alwaysusestrongpasswo

What Are the Different String Data Types in MySQL? A Detailed OverviewWhat Are the Different String Data Types in MySQL? A Detailed OverviewMay 07, 2025 pm 03:33 PM

MySQLofferseightstringdatatypes:CHAR,VARCHAR,BINARY,VARBINARY,BLOB,TEXT,ENUM,andSET.1)CHARisfixed-length,idealforconsistentdatalikecountrycodes.2)VARCHARisvariable-length,efficientforvaryingdatalikenames.3)BINARYandVARBINARYstorebinarydata,similartoC

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools