这是非常基本的代码.我仍然面临一个问题.我想我错过了一些东西,正如bootstrap网站上提到的那样
"可以单独包含插件(尽管有些插件需要依赖项),或者同时包含所有插件.bootstrap.js和bootstrap.min.js都包含单个文件中的所有插件."
所以我包括了boostrap.js并且仍然遇到了这个错误,其他依赖项是什么?
下面是代码.
<!DOCTYPE html>
<html>
<head>
<title>Member</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
</head>
<body>
<div class="well">
<input type="text" class="span3" id="search" data-provide="typeahead" data-items="4" />
</div>
<script>
var subjects = ['PHP', 'MySQL', 'SQL', 'PostgreSQL', 'HTML', 'CSS', 'HTML5', 'CSS3', 'JSON'];
$('#search').typeahead({source: subjects})
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
AADAM
我努力摆脱这个错误,但它不想离开我.
这是配置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:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<context:annotation-config />
<context:component-scan base-package="net.viralpatel.contact" />
<bean id="jspViewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:messages" />
<property name="defaultEncoding" value="UTF-8" />
</bean>
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
p:location="/WEB-INF/jdbc.properties" />
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
p:driverClassName="${jdbc.driverClassName}"
p:url="${jdbc.databaseurl}" p:username="${jdbc.username}"
p:password="${jdbc.password}" />
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property …Run Code Online (Sandbox Code Playgroud) 可能很难解释为什么,但我有这种情况,我需要获取当前请求的 url 的请求 url 映射字符串。
Like if I have a GET URL as "/Test/x/{number}"
I want to get "/Test/x/{number}" not "/Test/x/1"
Run Code Online (Sandbox Code Playgroud)
我可以在拦截器中获取实际声明的 url 字符串吗?
如果这是可能的,我怎么能做到这一点
我知道这个问题已被多次询问,我已经尝试了所有可能的解决方案仍然存在问题.实际上,同一个项目在Tomcat 8中以0错误运行,该错误直接从netbeans部署.我在eclipse中创建了一个新项目,并部署在Websphere Application Server 8.0中.然后一切顺利但URL无法识别.我的代码如下.
servlet.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:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd>
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
<mvc:annotation-driven />
<context:annotation-config />
<context:component-scan base-package="com.ibm.app" />
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="mediaTypes">
<map>
<entry key="html" value="text/html"/>
<entry key="json" value="application/json"/>
</map>
</property>
<property name="viewResolvers">
<list>
<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/Content/pages/" />
<property name="suffix" value=".jsp" />
</bean>
</list>
</property>
<property name="defaultViews">
<list>
<bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView"> …Run Code Online (Sandbox Code Playgroud) 我是hibernate的新手,我正在学习struts2 + hibernate并且已经通过网络上的例子进行了解.在其中一个示例中这里是strts2 + hibernate示例
我可以看到和做的是,用他们的id删除一个用户,正如我们在那里看到的那样,为列表中的每个用户提供了一个删除链接,session.delete()按id删除了记录,现在我想要用户在那里给出的文本字段中输入名称,并且应该能够按名称删除.到目前为止,我尝试过这样的
ActionMethod:
public String delete()
{
//HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get( ServletActionContext.HTTP_REQUEST);
//userDAO.delUser(Long.parseLong( request.getParameter("id")));
userDAO.delUser(user.getName());
return SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)
DAOImpl:
@Override
public void delUser(String userName) {
try {
User user = (User) session.get(User.class, userName);
session.delete(user);
} catch (Exception e) {
transaction.rollback();
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
我希望hibernate可以通过提供的任何字段值删除行.以上什么都不做.
问候
我使用的是Blueimp,服务器端是Java,Struts2.我无法找到使用Java的示例,无论如何我设法使用示例代码,但是"Empty file upload result"当我尝试上传单个文件时,我得到了.HTML部分是相同的,我不会在这里粘贴,因为它可能会很长.
jQuery是:
$(document).ready(function () {
'use strict';
// Initialize the jQuery File Upload widget:
$('#fileupload').fileupload();
// Enable iframe cross-domain access via redirect option:
$('#fileupload').fileupload(
'option',
'redirect',
window.location.href.replace(
/\/[^\/]*$/,
'/cors/result.html?%s'
)
);
if (window.location.hostname === 'blueimp.github.com') {
// Demo settings:
$('#fileupload').fileupload('option', {
url: '//jquery-file-upload.appspot.com/',
maxFileSize: 5000000,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
process: [
{
action: 'load',
fileTypes: /^image\/(gif|jpeg|png)$/,
maxFileSize: 20000000 // 20MB
},
{
action: 'resize',
maxWidth: 1440,
maxHeight: 900
},
{
action: 'save'
}
]
});
// Upload …Run Code Online (Sandbox Code Playgroud) <% if (Session["desig"].ToString() == "Developer"){%>
<td>
<select name='zone' id="zone" onchange="showLoc(this.value,'mlodg_loc')">
<option value="Select Zone">Select Zone</option>
<option value="East">East</option>
<option value="West">West</option>
<option value="North">North</option>
<option value="South1">South1</option>
<option value="South2">South2</option>
<option value="South3">South3</option>
</select>
</td>
<%}
else
{%>
<td>
<select name='zone' id="Select1" onchange="showLoc(this.value,'mlodg_loc')">
<option value="Select Zone">Select Zone</option>
<option value="<%#Session["zone"]%>"><%# Session["zone"].ToString() %></option>
</select>
</td>
<%}%>
Run Code Online (Sandbox Code Playgroud)
如果我直接写它,上面的代码工作正常,我试图在其他文件和我做的主文件中编写此代码 Response.WriteFile("zone.aspx")
如何包含它是否有任何方式可以包含,也想知道更好的方式来编写上述语句.
谢谢
您好我正在尝试使用jndi数据源.下面是代码
的context.xml
<Context antiJARLocking="true" path="/SpringMVCTest">
<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver"
maxActive="20" maxIdle="10" maxWait="10000"
name="jdbc/pluto" password=""
type="javax.sql.DataSource"
url="jdbc:mysql://localhost:3306/spring?zeroDateTimeBehavior=convertToNull"
username="pluto"/>
</Context>
Run Code Online (Sandbox Code Playgroud)
在spring-servlet配置bean中:
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jdbc/pluto" value="java:comp/env/jdbc/pluto"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
我收到这个错误
org.springframework.beans.factory.BeanCreationException:创建名为'contactController'的bean时出错:注入自动连接的依赖项失败; 嵌套异常是org.springframework.beans.factory.BeanCreationException:无法自动装配字段:private app.contact.service.ContactService app.contact.controller.ContactController.contactService; 嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'contactServiceImpl'的bean时出错:注入自动连接的依赖项失败; 嵌套异常是org.springframework.beans.factory.BeanCreationException:无法自动装配字段:private app.contact.dao.ContactDAO app.contact.service.ContactServiceImpl.contactDAO; 嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'contactDAOImpl'的bean时出错:注入自动连接的依赖项失败; 嵌套异常是org.springframework.beans.factory.BeanCreationException:无法自动装配字段:private org.hibernate.SessionFactory app.contact.dao.ContactDAOImpl.sessionFactory; 嵌套异常是org.springframework.beans.factory.BeanCreationException:创建在ServletContext资源[/WEB-INF/spring-servlet.xml]中定义名为'sessionFactory'的bean时出错:在设置bean属性时无法解析对bean'DataSource'的引用'数据源'; 嵌套异常是org.springframework.beans.factory.BeanCreationException:创建在ServletContext资源[/WEB-INF/spring-servlet.xml]中定义名称为'dataSource'的bean时出错:设置属性值时出错; 嵌套异常是org.springframework.beans.NotWritablePropertyException:bean类的无效属性'jdbc/pluto'[org.springframework.jndi.JndiObjectFactoryBean]:Bean属性'jdbc/pluto'不可写或具有无效的setter方法.setter的参数类型是否与getter的返回类型匹配?相关原因:org.springframework.beans.factory.BeanCreationException:在ServletContext资源[/WEB-INF/spring-servlet.xml]中定义创建名为'dataSource'的bean时出错:设置属性值时出错; 嵌套异常是org.springframework.beans.NotWritablePropertyException:bean类的无效属性'jdbc/pluto'[org.springframework.jndi.JndiObjectFactoryBean]:Bean属性'jdbc/pluto'不可写或具有无效的setter方法.setter的参数类型是否与getter的返回类型匹配?
sessionFactory.getCurrentSession().createQuery(
"delete from Attendance attend where attend.id in(Select att.id from Attendance att where att.dat= :dat and att.cls_id= :cls_id)"
).setDate("dat", dat).setShort("cls_id",cls_id); // delete all records with matching date and cls_id
sessionFactory.getCurrentSession().flush();
sessionFactory.getCurrentSession().clear();
// immediate save after delete in same transaction
for(Attendance a : absent){
sessionFactory.getCurrentSession().save(a);
}
Run Code Online (Sandbox Code Playgroud)
我试图删除具有特定条件的现有行,因为我保存的对象可能已存在于表中.但是删除不起作用,并且插入了重复值.请让我知道代码的哪一部分是错误的.
这是我的控制器.
@RequestMapping(value="/updateItem.htm", method = RequestMethod.GET, headers="Accept=*/*", produces = "application/json; charset=utf-8")
public @ResponseBody ModelAndView updateItem(ModelAndView model) {
List<String> list = aspireDAO.getSingleCol("select prod_id from items order by prod_id asc");
JsonArray jArray = AspireUtil.toJsonArray(list);
model.setViewName("UpdateItem");
model.addObject("items", jArray);
System.out.println(jArray);
return model;
}
Run Code Online (Sandbox Code Playgroud)
对于spring-servlet.xml中的jackson支持
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="mediaTypes">
<map>
<entry key="html" value="text/html"/>
<entry key="json" value="application/json"/>
</map>
</property>
<property name="defaultViews">
<list>
<bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView">
<property name="prefixJson" value="true"/>
</bean>
</list>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
json数组在我的控制器sysout语句中很好用.当我检查页面的源时,json数组就像这样打印
'["amgc","atup","ciwy","eyqe","ijm
Run Code Online (Sandbox Code Playgroud)
可能是什么原因.如何解决它.
AADAM
spring-mvc ×6
spring ×5
java ×4
hibernate ×2
java-ee ×2
jquery ×2
struts2 ×2
.net ×1
asp.net ×1
blueimp ×1
c# ×1
datasource ×1
file-upload ×1
gson ×1
hql ×1
jackson ×1
javascript ×1
jndi ×1
json ×1
spring-boot ×1
tomcat ×1
websphere ×1
websphere-8 ×1