以前我也写过ssh

《图书信息管理》的:http://blog.csdn.net/ssh159/article/details/52439676



快要考试了,顺便发个贴复习一下吧!
这个java 后端 是:
1、struts2,spring4.2,hibernate5.2,
ssh框架),实现功能:基本的增 删 改 查四个,
(写来写去都是这四个,
oracle数据库的 下次 带着 多表并联一起发。)
2、MysqL数据库,虽然用MysqL,但是只需要创建数据库,建表 由 实体类 的注解搞定!

这样一运行,就创建了表,然后可以直接插入数据了!

3、AJAX自动刷新


代码列表一览:

财务管理后台
(这里 电话号码:没有写11位数的约束,因为有些手机可能要加0,有些可能是座机等,大家自行在 实体类写注解吧!)



页面:


————————————————————————————————————————————

四个功能一览:

1、添加


2、其余三个:修改,删除,查询

(之前找不到好的截图软件,画质不堪入目!现在还好吧!)

查询的时候,做了:职业 和 姓名 查询2个,

每次输入后回车即可,但是会清除你的输入,空查询是 返回显示的页面,显示全部。



————————————————————————————————————————————————————

项目的检测流程:

1、运行tomat 相当于,启动default.jsp



2、先找struts.xml ,重定向跳转action;

3、Action 找 Service

4、Service 找Dao

5、Dao中的SessionFactory 事务管理找 applicationContext

6、ac 中的 sessionfactory 找 entity 实体类

————————————————————————————————————————————————

代码公布:

一、JAVA代码
二、SSH框架的代码
三、jsp 网页代码
四、其他代码

一、JAVA代码

1、ProductAction.java

package product.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionSupport;

import product.entity.Product;
import product.service.ProductService;
@SuppressWarnings("serial") //这个注解是取消警告的,不用也行。
@Controller 		//控制层注解
@Scope("prototype") //规范注解
public class ProductAction extends ActionSupport  {

	@Autowired
	private ProductService productService;
	
	private List<Product> list; //list会把信息输出到jsp页面的 table列表
	private Integer[] ids;
	private Product p;
	private String like;
	private Integer update_id;
	private String status;
	
	public String getStatus() {
		return status;
	}

	public Product getP() {
		return p;
	}

	public void setP(Product p) {
		this.p = p;
	}

	public void setUpdate_id(Integer update_id) {
		this.update_id = update_id;
	}

	public void setLike(String like) {
		this.like = like;
	}

	public List<Product> getList() {
		return list;
	}

	public void setIds(Integer[] ids) {
		this.ids = ids;
	}

//显示
	public String showAll(){
		list=productService.showAll();
		return "show";
	}
//添加	
	public String sendAdd(){
		p=null;
		status = "添加";
		return "send";
	}
	
	public String addPro(){
		productService.addPro(p);
		return "add";
	}
	
//删除	
	public String delPro(){
		productService.delPro(ids);
		return "del";
	}
	
//查询
	public String find(){
		if(like.isEmpty()){
			list=productService.showAll();
		}else{
			list=productService.find(like);
		}
		like="";
		return "find";
	}
	
//修改	
	public String updatePro(){
		productService.updatePro(p);
		return "update";
	}
	
	public String sendUpdate(){
		p=productService.find(update_id);
		p.setId(update_id);
		productService.updatePro(p);
		status = "修改";
		return "send";
	}
}

2.1、ProductDao.java

package product.dao;

import java.util.List;

import product.entity.Product;

public interface ProductDao {

	public List<Product> showAll();
	public void addPro(Product p);
	public void delPro(Integer[] ids);
	public List<Product> find(String like);
	public Product find(Integer id);
	public void updatePro(Product p);
}

2.2、ProductDaoImpl.java

package product.dao;

import java.util.Date;
import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import product.entity.Product;
@Repository	//数据库访问层的注解
@Scope("prototype")
public class ProductDaoImpl implements ProductDao {

//事务管理	
	@Autowired
	private SessionFactory sessionFactory;
	private Session getSession(){
		return sessionFactory.getCurrentSession();
	}
	@Override
	public List<Product> showAll() {
		return getSession().createquery("from Product",Product.class).getResultList();
	}
	@Override
	public void addPro(Product p) {
		p.setDate(new Date());
		getSession().save(p);
	}
	@Override
	public void delPro(Integer[] ids) {
		if(ids!=null){
			for(Integer id:ids){
				getSession().delete(getSession().find(Product.class,id));
			}
		}
	}

	public List<Product> find(String like){
		String sql="from Product where name like :name or profession like :profession ";
		return getSession().createquery(sql,Product.class)
				.setParameter("name","%"+like+"%")
				.setParameter("profession","%"+like+"%")
				.getResultList();
	}
	@Override
	public Product find(Integer id) {
		if(id!=null){
			return getSession().find(Product.class,id);
		}else{
			return null;
		}
	}
	@Override
	public void updatePro(Product p) {
		getSession().update(p);
	}
}

3、 实体类:Product.java

package product.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;


@Entity	//实体类注解
@Table(name="moneyjs")
public class Product {

	private Integer id;
	private String profession;
	private String name;
	private String work;
	private String remark;
	private String phone;
	private Integer money;
	private Date date;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	
	@Column(length=10)
	public String getProfession() {
		return profession;
	}
	public void setProfession(String profession) {
		this.profession = profession;
	}
	
	@Column(length=10)
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@Column(length=50)
	public String getWork() {
		return work;
	}
	public void setWork(String work) {
		this.work = work;
	}
	
	@Column(length=50)
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	@Column(length=11)
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	@Column
	public Integer getMoney() {
		return money;
	}
	public void setMoney(Integer money) {
		this.money = money;
	}
	
	@Column
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	
	@Override
	public String toString() {
		return "Product [id=" + id + ",profession=" + profession + ",name=" + name + ",work=" + work + ",remark="
				+ remark + ",phone=" + phone + ",money=" + money + ",date=" + date + "]";
	}
	
	/*@GeneratedValue(generator = "uuid")
	@GeneratedValue(generator = "uuid") @GenericGenerator(name = "uuid",strategy = "uuid")*/
	/*@ManyToOne(cascade={CascadeType.ALL},optional=true,fetch=FetchType.EAGER)
	@JoinColumn(name="orderid")

	@OnetoMany(mappedBy="order",cascade={CascadeType.ALL},fetch=FetchType.EAGER)*/
	
	
}

4.1、ProductService.java (service接口和dao接口是一样的)

package product.service;

import java.util.List;

import product.entity.Product;

public interface ProductService {

	public List<Product> showAll();
	public void addPro(Product p);
	public void delPro(Integer[] ids);
	public List<Product> find(String like);
	public Product find(Integer id);
	public void updatePro(Product p);
}

4.2、ProductServiceImpl.java (虽然是业务逻辑处理,其实是最简单了!)

package product.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import product.dao.ProductDao;
import product.entity.Product;
@Repository		//业务逻辑处理层的注解
@Scope("prototype")
public class ProductServiceImpl implements ProductService {

	@Autowired
	private ProductDao productDao;
	
	@Override
	public List<Product> showAll() {
		
		return productDao.showAll();
	}
	
	public void addPro(Product p){
		productDao.addPro(p);
	}

	public void delPro(Integer[] ids){
		productDao.delPro(ids);
	}
	
	public List<Product> find(String like){
		return productDao.find(like);
	}
	
	@Override
	public Product find(Integer id) {
		return productDao.find(id);
	}
	@Override
	public void updatePro(Product p) {
		productDao.updatePro(p);
	}
}

二、SSH框架层代码

1、applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"    
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
		xmlns:p="http://www.springframework.org/schema/p"  
		xmlns:aop="http://www.springframework.org/schema/aop"   
		xmlns:context="http://www.springframework.org/schema/context"  
		xmlns:jee="http://www.springframework.org/schema/jee"  
		xmlns:tx="http://www.springframework.org/schema/tx"  
		xsi:schemaLocation="    
			http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd  
			http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd  
			http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
			http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.2.xsd  
			http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd">
	<!-- 类似于财务部门一样,类就是钱,所有需要类的实例都由spring去管理 -->
	
	<!-- (本案例不用到,只是用了一个全盘扫描,以上内容只是为了让大家了解它) -->
	
	<context:component-scan base-package="product.."/>
	<context:property-placeholder location="classpath:jdbc.properties"/>
	<!-- <tx:annotation-driven transaction-manager="transactionManager"/> -->

	<bean id="myDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
		<property name="driverClass" value="${jdbc.driver}"/>
		<property name="jdbcUrl" value="${jdbc.url}"/>
		<property name="user" value="${jdbc.user}"/>
		<property name="password" value="${jdbc.password}"/>
		<!-- 每300秒检查所有连接池中的空闲连接 -->
		<property name="idleConnectionTestPeriod" value="300"/>
		<!-- 最大空闲时间,900秒内未使用则连接被丢弃。若为0则永不丢弃 -->
		<property name="maxIdleTime" value="900"/>
		<!-- 最大连接数 -->
		<property name="maxPoolSize" value="2"/>
	</bean>
	
	<bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionfactorybean">
		<property name="dataSource" ref="myDataSource"/>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.show_sql">true</prop>
				<prop key="hibernate.format_sql">true</prop>
				<prop key="hibernate.dialect">org.hibernate.dialect.MysqL5Dialect</prop>
				<prop key="hibernate.connection.autocommit">false</prop>
				<prop key="hibernate.hbm2ddl.auto">update</prop>
			</props>
		</property>
		<property name="packagesToScan">
		    <list>
		        <value>product.entity</value>
		    </list>
		</property>

	</bean>
	
	<bean id="transactionManager" 
		class="org.springframework.orm.hibernate5.HibernateTransactionManager">
	 	<!--  创建事务管理器,管理sessionFactory(因为所有的session都是从sessionFactory获取的) -->
	 	<property name="sessionFactory" ref="sessionFactory" />
	 </bean>
	<!--  配置通知,哪些方法需要切入什么类型的事务 -->	 
	<tx:advice id="advice" transaction-manager="transactionManager">
	 	<tx:attributes>
	 		<tx:method name="add*" propagation="required"/>
	 		<tx:method name="del*" propagation="required"/>
	 		<tx:method name="update*" propagation="required"/>
	 		<tx:method name="*" propagation="SUPPORTS" read-only="true"/>
	 	</tx:attributes>
	</tx:advice>
	 
	 <!-- 配置切面表达式,并且让 tx与切面表达式合二为一 -->
	 <aop:config>
	 	<!-- 表达式,定义哪个包的哪些类需要切入事务,但是此处并且没有制定类中哪些方法,需要切入什么样 事务 -->
	 	<aop:pointcut expression="execution(* product.dao.*.*(..))" id="pointcut" />
	 	<aop:advisor advice-ref="advice" pointcut-ref="pointcut"/>
	 </aop:config>
</beans>
			

2、jdbc.properties (由于偷懒,只写了一套MysqL的数据库连接信息,oracle的没写呢)

我的MysqL 密码是空的

jdbc.driver:com.MysqL.jdbc.Driver
jdbc.url:jdbc:MysqL:///gfmoney
jdbc.user:root
jdbc.password:

3、struts.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
	"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
	"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
	<constant name="struts.objectFactory" value="spring" />
	<constant name="struts.devMode" value="true" />  <!-- 开发者模式,要是报错找不到,请注释这一行 -->
	<constant name="struts.ui.theme" value="simple"/>
	<package name="mypck001" extends="struts-default">
		<action name="product_*" class="productAction" method="{1}">
			<result name="show">/WEB-INF/jsp/index.jsp</result>
			<result name="find">/WEB-INF/jsp/index.jsp</result>
			<result name="del" type="redirect">product_showAll</result>
			<result name="add" type="redirect">product_showAll</result>
			<result name="update" type="redirect">product_showAll</result>
			<result name="send">/WEB-INF/jsp/add.jsp</result>
		</action>
	</package>
</struts>

4、WebContext 目录下,web.xml

struts :检测

spring:监听

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>pro3</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  
<error-page>
  	<error-code>404</error-code>
  	<location>/WEB-INF/jsp/error.jsp</location>
</error-page>
<error-page>
  	<error-code>500</error-code>
  	<location>/WEB-INF/jsp/error.jsp</location>
</error-page>
  
  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
  </context-param>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
</web-app>

三、jsp页面代码:

1、add.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<Meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加/修改页面</title>
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
</head>
<body>
<center>

<s:form action="product_addPro.action" id="myform">
	职业:<s:textfield name="p.profession" value="%{p.profession}"/><br>
	姓名:<s:textfield name="p.name" value="%{p.name}"/><br>
	工作:<s:textfield name="p.work" value="%{p.work}"/><br>
	备注:<s:textfield name="p.remark" value="%{p.remark}"/><br>
	电话:<s:textfield name="p.phone" value="%{p.phone}"/><br>
	工钱:<s:textfield name="p.money" value="%{p.money}"/><br>
	时间:<s:textfield name="p.date" value="%{p.date}"/> <br>
	<s:hidden id="hidden" value="%{status}"/>
	<s:hidden name="p.id" value="%{p.id}"/>
	<s:submit value="添加" id="btn"/>
</s:form>

</center>

<script type="text/javascript">
$(function(){
	$("#btn").val($("#hidden").val());
	$("#btn").click(function(){
		if($(this).val()=="修改"){
			$("#myform").prop("action","product_updatePro.action");
		}else{
			$("#myform").prop("action","product_addPro.action");
		}
	})
})

</script>
</body>
</html>

2、index.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<Meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>某婚庆财务管理系统</title>
<style>	
  /* body{background: url(js/ct.jpg);width:100%} */
  body{color:#666666;}
  #table_all{text-align: center;}
  
  table{width:1000px;border:1px solid black;text-align: center; margin-top: 30px;}
  th,td{border:1px black solid;}
  #query,#delete,#sendAdd{
  text-decoration: none;
  width: 80dp;height: 35dp;font-size: 18px;}
  #delete{color:red;}
  #query2{width: 220px;height: 25px;}
</style>

</head>
<body>
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>

<center>
	
	<h2 style="color: #00a2e3">xx婚庆财务管理系统</h2>
	
<s:form action="product_find">
	
	模糊查询:<input id="query2" name="like" placeholder=" 姓名 或 职业查询"> <s:submit id="query" value="查询"/>
	
</s:form>
<s:form action="product_delPro.action">
	<table border="1">
		<tr>
			<th>选择</th>
			<th>id</th>
			<th>职业</th>
			<th>姓名</th>
			<th>工作</th>
			<th>备注</th>
			<th>电话号码</th>
			<th>工钱</th>
			<th>日期</th>
			<th>操作</th>
		</tr>
	<s:iterator value="list" status="status">
			<tr>
				<td><s:checkBox fieldValue="%{id}" name="ids" value="false"/></td>
				<td><s:property value="id"/></td>
				<td><s:property value="profession"/></td>
				<td><s:property value="name"/></td>
				<td><s:property value="work"/></td>
				<td><s:property value="remark"/></td>
				<td><s:property value="phone"/></td>
				<td><s:property value="money"/></td>
				<td><s:date name="date" format="yyyy-MM-dd,hh:mm"/></td>
				<td><s:a href="product_sendUpdate?update_id=%{id}">修改</s:a></td>
			</tr>
	</s:iterator>
	<tr style="background-color: white;">
		<td colspan="6" align=center><s:submit  style="margin: 5px;" id="delete" value="删除"/></td>
		<td colspan="4" align=center><Button  style="margin: 5px;"><s:a id="sendAdd" href="product_sendAdd">添加</s:a></Button></td>
	</tr>
			
	</table>
</s:form>

</center>

<script type="text/javascript">
	$(function(){
		$("tr:even").css("background","#d2d2d2");
		
	});
	
</script>

</body>
</html>

3、error.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<Meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<center>	
	<h2>页面出错了 <b style="color:red;"> --来自异世界的客户端</b></h2>
</center>	
</body>
</html>

4、default.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	response.sendRedirect("product_showAll.action");
%>

四、其余:

WebContext 文件夹的 js-jquery1.7.js

WEB-INF 目录下的lib包一共 60个jar包 (58个ssh,一个sql,一个MysqL )

ssh框架搭建:婚庆财务管理系统,AJAX自动刷新,实现增删改查四个功能,的更多相关文章

  1. xcode6.1 – Xcode 6.1中项目模板中缺少类前缀

    项目模板上曾经有一个类前缀字段,这有助于区分项目类和框架类.Xcode6.1项目模板中不再提供此功能.这背后的意图是什么?

  2. ios – 伞框架

    错误.应用程序,通常位于…错误仍然存在你也可以在这里添加(子)框架的路径.

  3. ios – UIView框架大小的问题

    我正在开发一个iPad项目,目前正在使用Landscape视图.我试着这样做:为什么这总是返回960?虽然在景观中,视图本身的高度尺寸应为768对吗?

  4. 安装自定义cocoa框架的最佳方法

    我有一个自定义框架,遵循Apple的框架编程指南>>中的建议.Installingyourframework我在/Library/Frameworks中安装.我通过使用以下脚本添加RunScript构建阶段来完成此操作:在我的项目中,我然后链接/Library/Frameworks/MyFramework并将其导入我的类中,如下所示:这非常有效,除了我总是在调试器控制台中看到以下消息:Loadin

  5. ios – 在设备上构建和运行时,仅将嵌入式框架与其他动态框架链接失败

    TL;博士将您的嵌入式框架与其他框架链接,并且不将其他框架与您的应用程序链接,导致Build&在设备上运行.描述:建立:我的设置非常简单(Swift2.3&XcodeXcode8.0;Build版本8S162m):>使用Carthage(0.17.2)我用xcodebuild8.0和TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3carthagebui

  6. iOS 8嵌入式框架中的头文件

    我正在尝试创建一个用于iOS8的嵌入式框架.在创建一个名为SampleKit(BTW;这里有任何约定,我应该使用前缀吗?)之后,它包含一个令我困惑的头文件:我知道FOUNDATION_EXPORT是extern或extern“C”的宏,但我不确定这两个常量.我应该在哪里为他们设定价值?解决方法项目>构建设置>版本控制>当前项目版本:

  7. 在Monotouch上模拟.NET的框架?

    有没有人使用过他们发现与Monotouch兼容的.NET模拟框架?在尝试使用之前,我很好奇与NMock,NSubstitute,Moq和其他框架的兼容性.Xamarin刚刚加强了它的单元测试支持,但没有提到模拟框架.仅供参考,我希望在VS2010上为非UI位做很多开发,并在UI进入时移动到iOS平台.谢谢您的帮助.解决方法我建议只使用手动模拟:如果我不得不猜测RhinoMocks,Moq等大量使用Reflection.Emit(你怎么能做他们能做的疯狂?),这将无法在MonoTouch上使用AOT编译器运

  8. 在ios上使用来自框架的boost :: filesysystem路径

    我一直在使用Boost作为PeteGoodliffe脚本构建的框架已有一段时间了.效果很好.最近我遇到了一个问题,可以通过将以下代码放入另一个全新的XCode项目中的视图控制器的viewDidLoad中来重现:当路径对象被销毁时会导致EXC_BAD_ACCESS.有没有其他人遇到这个问题?

  9. ios – 在约束依赖于框架的自定义视图中使用自动布局

    我正在编写一个以编程方式初始化的自定义视图.我重写updateConstraints以添加此视图所需的所有约束.:问题是self.bounds返回CGRectZero的等价物.我做了我的研究并根据这个objc.ioarticle,这是预期的,因为在调用layoutSubviews之前框架不会被设置.它也提到了Toforcethesystemtoupdatethelayoutofaviewtreei

  10. ios – “禁用模块时使用’@import’”错误 – 启用模块和链接框架= YES

    我有一个使用CocoaPods并使用’SCLAlertView-Objective-C’窗格的项目.该pod使用@importUIKit;模块样式导入.我在目标和项目设置中将“启用模块(C&Objective-C)”和“自动链接框架”设置为YES.当模块被禁用时,我仍然得到“使用’@import’错误.有没有什么可以阻止Xcode能够启用模块,如使用.pch文件,任何链接器标志,或者我没有提到的任

随机推荐

  1. xe-ajax-mock 前端虚拟服务

    最新版本见Github,点击查看历史版本基于XEAjax扩展的Mock虚拟服务插件;对于前后端分离的开发模式,ajax+mock使前端不再依赖后端接口开发效率更高。CDN使用script方式安装,XEAjaxMock会定义为全局变量生产环境请使用xe-ajax-mock.min.js,更小的压缩版本,可以带来更快的速度体验。

  2. vue 使用 xe-ajax

    安装完成后自动挂载在vue实例this.$ajaxCDN安装使用script方式安装,VXEAjax会定义为全局变量生产环境请使用vxe-ajax.min.js,更小的压缩版本,可以带来更快的速度体验。cdnjs获取最新版本点击浏览已发布的所有npm包源码unpkg获取最新版本点击浏览已发布的所有npm包源码AMD安装require.js安装示例ES6Module安装通过Vue.use()来全局安装示例./Home.vue

  3. AJAX POST数据中文乱码解决

    前端使用encodeURI进行编码后台java.net.URLDecoder进行解码编解码工具

  4. Koa2框架利用CORS完成跨域ajax请求

    实现跨域ajax请求的方式有很多,其中一个是利用CORS,而这个方法关键是在服务器端进行配置。本文仅对能够完成正常跨域ajax响应的,最基本的配置进行说明。这样OPTIONS请求就能够通过了。至此为止,相当于仅仅完成了预检,还没发送真正的请求呢。

  5. form提交时,ajax上传文件并更新到&lt;input&gt;中的value字段

  6. ajax的cache作用

    filePath="+escape;},error:{alert;}});解决方案:1.加cache:false2.url加随机数正常代码:网上高人解读:cache的作用就是第一次请求完毕之后,如果再次去请求,可以直接从缓存里面读取而不是再到服务器端读取。

  7. 浅谈ajax上传文件属性contentType = false

    默认值为contentType="application/x-www-form-urlencoded".在默认情况下,内容编码类型满足大多数情况。在这里,我们主要谈谈contentType=false.在使用ajax上传文件时:在其中先封装了一个formData对象,然后使用post方法将文件传给服务器。说到这,我们发现在JQueryajax()方法中我们使contentType=false,这不是冲突了吗?这就是因为当我们在form标签中设置了enctype=“multipart/form-data”,

  8. 909422229_ajaxFileUpload上传文件

    ajaxFileUpload.js很多同名的,因为做出来一个很容易。我上github搜AjaxFileUpload出来很多类似js。ajaxFileUpload是一个异步上传文件的jQuery插件传一个不知道什么版本的上来,以后不用到处找了。语法:$.ajaxFileUploadoptions参数说明:1、url上传处理程序地址。2,fileElementId需要上传的文件域的ID,即的ID。3,secureuri是否启用安全提交,默认为false。4,dataType服务器返回的数据类型。6,error

  9. AJAX-Cache:一款好用的Ajax缓存插件

    原文链接AJAX-Cache是什么Ajax是前端开发必不可少的数据获取手段,在频繁的异步请求业务中,我们往往需要利用“缓存”提升界面响应速度,减少网络资源占用。AJAX-Cache是一款jQuery缓存插件,可以为$.ajax()方法扩展缓存功能。

  10. jsf – Ajax update/render在已渲染属性的组件上不起作用

    我试图ajax更新一个有条件渲染的组件。我可以确保#{user}实际上是可用的。这是怎么引起的,我该如何解决呢?必须始终在ajax可以重新呈现之前呈现组件。Ajax正在使用JavaScriptdocument.getElementById()来查找需要更新的组件。但是如果JSF没有将组件放在第一位,那么JavaScript找不到要更新的内容。解决方案是简单地引用总是渲染的父组件。

返回
顶部