当前位置: 首页 > news >正文

搜索引擎是软件还是网站wordpress 树形页面

搜索引擎是软件还是网站,wordpress 树形页面,网页版qq安全中心登录入口,湛江在线制作网站在上一篇jsf环境搭建的基础上 , 加入spring框架 , 先看下目录结构 src/main/resources 这个source folder 放置web项目所需的主要配置,打包时,会自动打包到WEB-INF下 首先看下pom.xml,需要引入一些依赖项: 1 project xmlnshttp://maven.apache.org/POM/4.0.0 x…在上一篇jsf环境搭建的基础上 , 加入spring框架 , 先看下目录结构 src/main/resources 这个source folder 放置web项目所需的主要配置,打包时,会自动打包到WEB-INF下 首先看下pom.xml,需要引入一些依赖项: 1 project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance2 xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd3 modelVersion4.0.0/modelVersion4 groupIdyjmyzz/groupId5 artifactIdjsf-web/artifactId6 version1.0/version7 packagingwar/packaging8 9 10 dependencies 11 !-- 单元测试 -- 12 dependency 13 groupIdjunit/groupId 14 artifactIdjunit/artifactId 15 version4.7/version 16 scopetest/scope 17 /dependency 18 19 !-- jsf -- 20 dependency 21 groupIdorg.jboss.spec.javax.faces/groupId 22 artifactIdjboss-jsf-api_2.1_spec/artifactId 23 version2.1.19.1.Final-redhat-1/version 24 scopecompile/scope 25 /dependency 26 27 28 !-- spring -- 29 dependency 30 groupIdorg.springframework/groupId 31 artifactIdspring-context/artifactId 32 version4.0.2.RELEASE/version 33 /dependency 34 35 36 dependency 37 groupIdorg.springframework/groupId 38 artifactIdspring-web/artifactId 39 version4.0.2.RELEASE/version 40 /dependency 41 42 43 !-- servlet支持 -- 44 dependency 45 groupIdjavax.servlet/groupId 46 artifactIdservlet-api/artifactId 47 version2.5/version 48 /dependency 49 50 /dependencies 51 52 build 53 plugins 54 plugin 55 artifactIdmaven-compiler-plugin/artifactId 56 version3.1/version 57 configuration 58 source1.7/source 59 target1.7/target 60 /configuration 61 /plugin 62 plugin 63 artifactIdmaven-war-plugin/artifactId 64 version2.3/version 65 configuration 66 warSourceDirectorywebapp/warSourceDirectory 67 failOnMissingWebXmlfalse/failOnMissingWebXml 68 /configuration 69 /plugin 70 /plugins 71 /build 72 /project pom.xml   1. 自动加载配置文件 在web项目中,可以让spring自动加载配置文件(即上图中的src/main/resouces/spring下的xml文件),WEB-INF/web.xml中参考以下设置: 1 ?xml version1.0 encodingUTF-8?2 web-app xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xmlnshttp://java.sun.com/xml/ns/javaee xsi:schemaLocationhttp://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd idWebApp_ID version3.03 display-namejsf-web/display-name4 5 welcome-file-list6 welcome-fileindex.html/welcome-file 7 /welcome-file-list8 9 listener 10 listener-class 11 org.springframework.web.context.ContextLoaderListener 12 /listener-class 13 /listener 14 15 context-param 16 param-namecontextConfigLocation/param-name 17 param-value 18 classpath*:spring/applicationContext-*.xml 19 /param-value 20 /context-param 21 22 /web-app web.xml 解释一下: classpath*:spring/applicationContext-*.xml 这里表示将加载classpath路径下 spring目录下的所有以applicationContext-开头的xml文件 , 通常为了保持配置文件的清爽 , 我们会把配置分成多份 : 比如 applicationContext-db.xml 用来配置DataSource , applicationContext-cache.xml用来配置缓存...等等.   2.代码中如何取得ApplicationContext实例 1 package yjmyzz.utils;2 3 import javax.faces.context.FacesContext;4 import javax.servlet.ServletContext;5 6 import org.springframework.context.ApplicationContext;7 import org.springframework.web.context.support.WebApplicationContextUtils;8 9 public class ApplicationContextUtils { 10 11 public static ApplicationContext getApplicationContext() { 12 ServletContext context (ServletContext) FacesContext 13 .getCurrentInstance().getExternalContext().getContext(); 14 ApplicationContext appctx WebApplicationContextUtils 15 .getRequiredWebApplicationContext(context); 16 17 return appctx; 18 } 19 20 public static T T getBean(ClassT t) { 21 return getApplicationContext().getBean(t); 22 } 23 } ApplicationContextUtils  有了这个工具类 , 就可以方便的取得注入的Bean   3. 使用properties文件注入 为了演示注入效果,先定义一个基本的Entity类 1 package yjmyzz.entity;2 3 import java.io.Serializable;4 5 public class ProductEntity implements Serializable {6 7 private static final long serialVersionUID -2055674628624266800L;8 /*9 * 产品编码 10 */ 11 private String productNo; 12 13 /** 14 * 产品名称 15 */ 16 private String productName; 17 18 /** 19 * 产品ID 20 */ 21 private Long productId; 22 23 public String getProductNo() { 24 return productNo; 25 } 26 27 public void setProductNo(String productNo) { 28 this.productNo productNo; 29 } 30 31 public String getProductName() { 32 return productName; 33 } 34 35 public void setProductName(String productName) { 36 this.productName productName; 37 } 38 39 public Long getProductId() { 40 return productId; 41 } 42 43 public void setProductId(Long productIdLong) { 44 this.productId productIdLong; 45 } 46 47 Override 48 public String toString() { 49 return productId / productNo / productName; 50 } 51 52 } ProductEntity 然后在applicationContext-beans.xml中配置以下内容: 1 ?xml version1.0 encodingUTF-8?2 beans xmlnshttp://www.springframework.org/schema/beans3 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance4 xsi:schemaLocationhttp://www.springframework.org/schema/beans5 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd6 7 bean idpropertyConfigurer8 classorg.springframework.beans.factory.config.PropertyPlaceholderConfigurer9 property namelocations 10 list 11 valueclasspath:properties/*.properties/value 12 /list 13 /property 14 /bean 15 16 bean idproductEntity classyjmyzz.entity.ProductEntity 17 property nameproductId value${product.id} / 18 property nameproductNo value${product.no} / 19 property nameproductName value${product.name} / 20 !-- property nameproductId 21 bean classjava.lang.Long 22 constructor-arg index0 value${product.id} / 23 /bean 24 /property 25 -- 26 /bean 27 /beans spring配置文件 注:classpath:properties/*.properties表示运行时 , spring容器会自动加载classpath\properties目录下的所有以.properties后缀结尾的文件 ,  我们在src/main/resources/properties/下放置一个product.properties属性文件 , 内容如下: 1 product.id3 2 product.non95 3 product.namephone product.properties 该文件被spring自动加载后 , 就可以用里面定义的属性值 , 为Bean做setter属性注入 , 即配置文件中的property nameproductId value${product.id} /   4.验证注入是否成功 在HomeController里 ,  向Spring容器要一个Bean ,  显示下它的属性: 1 package yjmyzz.controller;2 3 import javax.faces.bean.ManagedBean;4 5 import yjmyzz.entity.ProductEntity;6 import yjmyzz.utils.ApplicationContextUtils;7 8 ManagedBean(name Home)9 public class HomeController { 10 11 public String sayHello() { 12 13 ProductEntity product ApplicationContextUtils 14 .getBean(ProductEntity.class); 15 16 return product.toString(); 17 } 18 19 } HomeController index.xhtml里仍然跟上篇相同: 1 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd 2 html xmlnshttp://www.w3.org/1999/xhtml3 xmlns:hhttp://java.sun.com/jsf/html4 xmlns:fhttp://java.sun.com/jsf/core5 xmlns:uihttp://java.sun.com/jsf/facelets 6 7 h:head8 titlejsf-web/title9 /h:head 10 body 11 h1 12 #{Home.sayHello()} 13 14 /h1 15 /body 16 /html index.xhtml   最后部署到jboss上 , 运行截图如下:    转载于:https://www.cnblogs.com/yjmyzz/p/3604007.html
http://www.zqtcl.cn/news/857795/

相关文章:

  • 南通网站关键词优化wordpress做小程序
  • 上海企业网站seo多少钱做网站图片链接到天猫
  • 属于教育主管部门建设的专题资源网站是广西壮锦网站建设策划书
  • 云南网站制作一条龙网站建设公司对比分析报告
  • 手机网站客户端网站语言有几种
  • 做网站怎么选取关键词中企动力销售陪酒多吗
  • 新网站做内链雅虎网站收录提交入口
  • 简述建设一个网站的具体过程接做名片的网站
  • 怎样建立自己网站网站产品数据如何恢复
  • 用wordpress建立电商网站用Off做网站
  • 网站建设公司不赚钱ui设计软件培训学校
  • 网站项目策划书模板wordpress修改模版
  • 房地产手机网站模板电脑建立网站
  • 网站自适应手机代码网络服务机构的网站
  • 系统网站重庆智能建站模板
  • wordpress适合优化吗宝塔 wordpress优化
  • 怎么利用网站做外链接怎样做公司网站介绍
  • 广州网站优化渠道木门网站模板
  • 手机网站菜单设计wordpress加联系方式
  • 网站管理助手怎么使用多种郑州网站建设
  • 汉中网站建设费用外贸网站服务商
  • 苏宿工业园区网站建设成功案例色流网站如何做
  • 北沙滩网站建设公司电子商务网站建设管理论文
  • 公司备案证查询网站查询系统网页设计html代码大全及含义
  • 成都开发网站建设做网站一般会出现的问题
  • 企业网站设计布局方式如何在社交网站上做视频推广方案
  • 惠城网站建设服务做1688网站需要懂英语吗
  • 请人做网站要多少钱搜索引擎优化概述
  • 郑州中森网站建设免费网站app生成软件
  • 做诚信通网站seo新手快速入门