当前位置:  编程技术>WEB前端
本页文章导读:
    ▪点滴积累---Ajax传值(三层)笔记      Ajax传值(三层):1.在前台页面JS中的写法,获得页面的数据,然后向.CS中传值,并返回值判断是否成功。代码: 1 <script language="javascript"> 2 var title=$("#tb1").val(); 3 var contents=$("#tb2").v.........
    ▪国外24个jQuery搜索插件       我们在日常的网站开发中,常常会用到一些搜索方面的插件。选择这些插件会让我们的站点更加方便美观,但如何选择一款好的插件成为了我们的重点。这里我向大家推荐24款用得比较好.........
    ▪JSTL核心标签库      JSTL 核心标签库 使用 JSTL 核心标签库标签共有13个,功能上分为4类: 1.表达式控制标签:out、set、remove、catch 2.流程控制标签:if、choose、when、otherwise 3.循环标签:forEach、forTokens 4.URL操作标.........

[1]点滴积累---Ajax传值(三层)笔记
    来源:    发布时间: 2013-11-06

Ajax传值(三层):

1.在前台页面JS中的写法,获得页面的数据,然后向.CS中传值,并返回值判断是否成功。

代码:

1 <script language="javascript">
2 var title=$("#tb1").val();
3 var contents=$("#tb2").val();
4 $.ajax({
5 type:"post",
6 dataType:"josn",
7 data:{jian:title,jian2:contents},
8 success:function(data){
9 if(data.result=="0"{
10 alert("添加失败");
11 }
12 else{
13 alert("添加成功");
14 }
15 },
16 error:function(data){
17 alert("错误");
18 }
19 })
20
21 </script>

2.后台.cs中的写法,目的是把前天获得的数据传给BLL中。

代码:

1 protected void bt1_Click(object sender, EventArgs e)
2 {
3 string title = Context.Request["jian"];//这两句是把前台JS中获得的值存起来。
4 string conte = Context.Request["jian2"];
5 int result = new BLL.ArticlesManager.Add(title, content);//向BLL中传值,并且返回。
6 Response.Write("{\"result\":\"" + result + "\"}");把获得的值
7 //"{"键":"值"}"它格式就是这样的,如果不是这样的格式,必须经过转移才可以。
8 // "{\"result\":\""+result+"\"}"
9 }

3.在BLL中获得.cs中的值并且传入DAL中
代码:

1 public static int Add(string title,string content)
2 {
3 return new DAL.ArticlesService.Add(title,content);
4 }

4.在DAL中就和普通的一样了就是添加进去数据,

代码:

1 public static int Add(string title,string content)
2 {
3 string sql = "insert into Articles (Title,Contents)values(@title,@contents)";
    
[2]国外24个jQuery搜索插件
    来源:    发布时间: 2013-11-06

 我们在日常的网站开发中,常常会用到一些搜索方面的插件。选择这些插件会让我们的站点更加方便美观,但如何选择一款好的插件成为了我们的重点。

这里我向大家推荐24款用得比较好的搜索插件,满足大家日常开发需要

Ajax Pagination With Search

 

This is a complete solution for paginations. The developer makes a database connection, limits the maximum of records per page, performs a custom query on pages that wants to paginate, calls the pagination class, limits the number of links on p
 
Mass Ping Tool

 
Fully featured mass ping tool allows you to create your own complete ping service and begin sending an unlimited amount of pings to inform search engines such as Google of new web pages, or content changes. Replicate a service such as Pingler,
 
SoundCloud Search &amp; API Integration

 
This app enables you to access millions of sounds from the SoundCloud API . More than 10 millions artists and musician are using this growing website, and through this app you can search, access and listen to all their creations, supporting th
 
Search&amp;Play Stylish Player

 
With Search&Play Stylish Player you can run your own stylish music site. All you need to do is to edit the very light PHP site (4MB including the wallpaper files and location database) with your own information and upload the files to your ow
 
PHP Book Search Engine

 
PHP Book Search Engine is a unique advanced search engine for books, it uses the Google Books API to get the information, it has various filters and search filters such as Book Name, Author or ISBN . It’s also mobile compatible for the be
 
PHP Video Search Engine

 
PHP Video Search Engine is an advanced video search engine based on YouTube’s Search API it’s a powerful tool for searching for videos, it includes a series of filters and two types of displaying the results which are list and grid, also
 
PHP Google, Yahoo &amp; Bing Live Search

 

This PHP script provides google, yahoo and bing live search widget box for your website.Enrich your website user experience with this very cool piece of software that offers instant Google Live Search, Yahoo Live Search and Bing Live Search r
 
PHP SERP Services

 
Do you need Google Search, Yahoo Search or Bing Search to be available as services for your web site? PHP SERP services is the script that enables you to embed the most common search engines results right inside your site pages. No need for an
 
PHP Search Engine

 
IMPORTANT: Those who already purchased the script, please update to the last version as I improved it with a tons of new features (scroll down to see the changelog) . Advanced PHP Search Engine using Bing API system, it gives you results for We
 

    
[3]JSTL核心标签库
    来源: 互联网  发布时间: 2013-11-06
JSTL 核心标签库 使用

JSTL 核心标签库标签共有13个,功能上分为4类:

1.表达式控制标签:out、set、remove、catch

2.流程控制标签:if、choose、when、otherwise

3.循环标签:forEach、forTokens

4.URL操作标签:import、url、redirect

使用标签时,一定要在jsp文件头加入以下代码:

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


下面分别对这些标签进行说明:

1. <c:out> 用来显示数据对象(字符串、表达式)的内容或结果

使用Java脚本的方式为:<% out.println("hello") %> <% =表达式 %>

使用JSTL标签:<c:out value="字符串">,例如:

那么网页显示效果为:

<body>
  <c:out value="<要显示的数据对象(未使用转义字符)>" escapeXml="true" default="默认值"></c:out><br/>
  <c:out value="<要显示的数据对象(使用转义字符)>" escapeXml="false" default="默认值"></c:out><br/>
  <c:out value="${null}" escapeXml="false">使用的表达式结果为null,则输出该默认值</c:out><br/>
</body>

 


2. <c:set> 用于将变量存取于 JSP 范围中或 JavaBean 属性中。下面的例子中假设已经有 Person.java 这个类文件。

<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@page contentType="text/html; charset=utf-8" %>

<jsp:useBean id="person" class="lihui.Person"></jsp:useBean>

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>JSTL测试</title>
  </head>
  
  <body>
  <c:set value="张三" var="name1" scope="session"></c:set>
  <c:set var="name2" scope="session">李四</c:set>
  <c:set value="赵五" target="${person}" property="name"></c:set>
  <c:set target="${person}" property="age">19</c:set>
  <li>从session中得到的值:${sessionScope.name1}</li>
  <li>从session中得到的值:${sessionScope.name2}</li>
  <li>从Bean中获取对象person的name值:<c:out value="${person.name}"></c:out></li>
  <li>从Bean中获取对象person的age值:<c:out value="${person.age}"></c:out></li>
  </body>
</html>

 

一共有四种语法格式,前两种是给jsp的范围变量赋值,后两个是给 javabean 变量赋值

效果如下:

3.<c:remove> 主要用来从指定的 jsp 范围内移除指定的变量。使用类似,下面只给出语法:

<c:remove var="变量名" [scope="page|request|session|application"]></c:remove>


4.<c:catch> 用来处理 JSP 页面中产生的异常,并存储异常信息

<c:catch var="name1">

容易产生异常的代码

</c:catch>

如果抛异常,则异常信息保存在变量 name1 中。

5.<c:if>

<c:if test="条件1" var="name" [scope="page|request|session|application"]></c:remove>

例:

  <body>
  <c:set value="赵五" target="${person}" property="name"></c:set>
  <c:set target="${person}" property="age">19</c:set>
  <c:if test="${person.name == '赵武'}" var="name1"></c:if>
  <c:out value="name1的值:${name1}"></c:out><br/>
  <c:if test="${person.name == '赵五'}" var="name2"></c:if>
  <c:out value="name2的值:${name2}"></c:out>
  </body>

效果:

6. <c:choose> <c:when> <c:otherwise> 三个标签通常嵌套使用,第一个标签在最外层,最后一个标签在嵌套中只能使用一次

例:

   
 <c:set var="score">85</c:set>
    <c:choose>
    <c:when test="${score>=90}">
    你的成绩为优秀!
    </c:when>
    <c:when test="${score>=70&&score<90}">
    您的成绩为良好!
    </c:when>
    <c:when test="${score>60&&score<70}">
    您的成绩为及格
    </c:when>
    <c:otherwise>
    对不起,您没有通过考试!
    </c:otherwise>
    </c:choose>

7.<c:forEach>

语法:<c:forEach var="name" items="Collection" varStatus="statusName" begin="begin" end="end" step="step"></c:forEach>

该标签根据循环条件遍历集合 Collection 中的元素。 var 用于存储从集合中取出的元素;items 指定要遍历的集合;varStatus 用于存放集合中元素的信息。varStatus 一共有4种状态属性,下面例子中说明:

 1 <%@ page contentType="text/html;charset=GBK" %>
 2 <%@page import="java.util.List"%>
 3 <%@page import="java.util.ArrayList"%>
 4 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 5 <html>
 6 <head>
 7     <title>JSTL: -- forEach标签实例</title>
 8 </head>
 9 <body>
10 <h4><c:out value="forEach实例&quo      
    
最新技术文章:
 




特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3