我有一个div,我正在显示许多与笔记本电脑相关的过滤数据.随着数据大小的增加,div增加了它的大小.
我希望div保持最大450px的大小然后如果数据增加滚动将自动进行.div大小不应该增加.
jsfiddle为它.
css:
.itemconfiguration
{
min-height:440px;
width:215px;
/* background-color:#CCC; */
float:left;
position:relative;
margin-left:-5px;
}
.left_contentlist
{
width:215px;
float:left;
padding:0 0 0 5px;
position:relative;
float:left;
border-right: 1px #f8f7f3 solid;
/* background-image:url(images/bubble.png); */
/* background-color: black; */
}
Run Code Online (Sandbox Code Playgroud)
谁能帮我实现这个目标?
我正在尝试向我的网页显示数据库数据.当我向GET请求时,我已经制作了以下代码@RequestMapping(value = "/api/binder").
但是当获取请求来到这个方法时,它将获取数据(我在控制台上打印并显示良好)但它没有映射到我的Java Script Ajax调用,它显示了一个错误.
以下是我获取数据的代码:
@Autowired
IBinderViewRepository repository;
@RequestMapping(method= RequestMethod.GET)
public @ResponseBody
List<BinderResponse> getBinders(){
List<BinderView> binders = repository.getBinders();
List<BinderResponse> responses = new ArrayList<>();
ModelMapper mapper = Mapper.getInstance();
for(int i = 0; i < binders.size(); i++){
System.out.println("In Loop");
BinderResponse response = mapper.map(binders.get(i),BinderResponse.class);
System.out.println("Data :: " + response.getBinderName());
responses.add(response);
}
return responses;
}
Run Code Online (Sandbox Code Playgroud)
但它显示我跟随错误:
HTTP Status 500 - Could not write JSON: (was java.lang.NullPointerException) (through reference chain: java.util.ArrayList[0]->com.ngl.dto.outgoing.BinderResponse["valid"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: java.util.ArrayList[0]->com.ngl.dto.outgoing.BinderResponse["valid"]) …Run Code Online (Sandbox Code Playgroud) 我有一个表,其中我有一个数字字段A,它被设置为UNIQUE.该字段用于指示必须执行某些操作的顺序.我想对所有更大的值进行更新,例如,超过3.例如,我有
A
1
2
3
4
5
Run Code Online (Sandbox Code Playgroud)
现在,我想为A大于3的所有值添加1.所以,结果就是
A
1
2
3
5
6
Run Code Online (Sandbox Code Playgroud)
问题是,是否可以只使用一个查询来完成?请记住,我对A列有一个UNIQUE约束.
显然,我试过了
UPDATE my_table SET A = A + 1 WHERE A > 3;
Run Code Online (Sandbox Code Playgroud)
但它不起作用,因为我对这个领域有约束.
我正在实施一个基于Web服务的大学管理系统.该系统将某些课程添加到数据库中.下面是我正在使用的代码.
Course.java
public class Course {
private String courseName;
private String location;
private String courseId;
public String getCourseId()
{
return courseId;
}
public void setCourseId(String courseId) {
this.courseId = courseId;
}
public String getCourseName() {
return courseName;
}
public void setCourseName(String courseName) {
this.courseName = courseName;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
}
Run Code Online (Sandbox Code Playgroud)
然后另一个文件如下
CourseDaoImpl.java
public class CourseDaoImpl implements IDao {
Connection conn = null;
Statement stmt = null; …Run Code Online (Sandbox Code Playgroud) 我正在向表中添加数据.表看起来像这样:

我从JSP页面获取多个数据,每次都应该输入唯一的数据.意味着表prod_id和sc_id将保持同样的这个要求.假设我得到了3个项目,那么我必须使用3个插入查询,它将逐个传递每个项目.
我正在使用JSP和sevlet.
所以我的问题是,使用单个INSERT语句是否有任何独特或其他方式?
我想创建一个方法来检查类实例是否为null.
我只知道我可以使用== null,但我想知道有没有其他方法可以实现检查实例是否为空?
我有几乎70-80类的实例.&所有类扩展相同的类BaseEntity.
在声明时我已声明每个实例如:
Entity1 instance1 = null;
像所以我已经定义了所有70 class instances.
当他们将被使用时,我正在使用new初始化它们.但在我的主要结束时Entity Processor,我必须存储它被初始化的每个实体ID的数据,所以为此我必须检查实例是否为空?
All Entities extend同一个班,BaseEntity所以我做了以下方法.
我只知道一种方法:
public boolean checkIfEntityNull(BaseEntity entity){
return entity != null ? true : false;
}
Run Code Online (Sandbox Code Playgroud)
如果它返回,true那么我将调用它,save method of repository to save data in DB否则它将不会调用save方法.
所以对它们的任何指导.
我使用Angularjs向我的服务器发送get http请求.服务器使用Spring MVC响应rest请求.这是我的角网址建筑上的代码片段:
var name="myname";
var query= "wo?d";
var url = "/search/"+query+"/"+name;
Run Code Online (Sandbox Code Playgroud)
这里是Spring MVC Controller:
@RequestMapping( value = "/search/{query}/{name}" , method = RequestMethod.GET , produces = MediaType.APPLICATION_JSON_VALUE )
@ResponseBody
public List<Data> search() {
// search logic
return data;
}
Run Code Online (Sandbox Code Playgroud)
当查询包含问号字符(?)时,我遇到了问题.url被拆分,以便Spring响应:WARN osweb.servlet.PageNotFound - 找不到带有URI的HTTP请求的映射[/ my-server/web/search/wo在DispatcherServlet中,名称为'mvc'
这是正确的,因为问号?介绍请求参数的开头.我试过使用js函数,encodeURI(query)但问号字符没有编码.如何在url中编码问号?谢谢
1)服务器向客户端发送消息.
2)入站通道适配器配置为等待来自用户的"手动"确认模式操作
3)"TaskBundlereceiver"bean正在实现"ChannelAwareMessageListener",在实现方法中,我正在执行消息确认.
我没有看到"TaskBundlereceiver"被执行.我错过了什么吗?
以下是我所解释的步骤的配置细节.
感谢您的意见.
@Override
public void onMessage(org.springframework.amqp.core.Message message, Channel channel) throws Exception
{
logger.debug("In onMessage method of the channel aware listener. message =["+message.getBody().toString()+"]");
channel.basicAck(message.getMessageProperties().getDeliveryTag(), true);
}
Run Code Online (Sandbox Code Playgroud)
XML配置:
<!-- Channel that receives the task bundle from the server for execution -->
<int:channel id="fromKServerChannel"/>
<int-amqp:inbound-channel-adapter id="taskBundleReceiverAdapter"
channel="fromKServerChannel"
error-channel="taskBundleErrorChannel"
acknowledge-mode="MANUAL"
expose-listener-channel="true"
queue-names="kanga_task_queue"
connection-factory="connectionFactory"
concurrent-consumers="20"/>
<int:chain input-channel="fromKServerChannel" output-channel="nullChannel">
<int:service-activator ref="taskBundleReceiver" method="onMessage"/>
<int:service-activator ref="taskBundleExecutor" method="executeBundle"/>
</int:chain>
Run Code Online (Sandbox Code Playgroud) 我们有一个方法:
public void foo (String s1, String s2, String s3) {
...
}
Run Code Online (Sandbox Code Playgroud)
并且是一个选择的集合.也许hashmap,也许是列表,并不重要.
有没有办法将"转换"集合转换为方法参数?就像是:
public void foo (getParamters(map)) { ... }
Run Code Online (Sandbox Code Playgroud)
是的,当然我能做到
public void foo (map.get(0), map.get(1), map.get(3)) { ... }
Run Code Online (Sandbox Code Playgroud)
但我正在考虑更自动的东西,这可以帮助我解决更大的问题.
在angular2应用程序上工作。我有RxJS计时器实例,该实例将在登录时向用户推送通知。但是,如果选项卡未处于活动状态,则不应推送通知,则调度程序应暂停/停止。也完成了。
但是主要的是,我已经将该窗口(焦点,模糊)事件侦听器添加到ngOnInit()中。当我们更改页面/组件时,我尝试在ngOnDestroy()上销毁它,但它也不会停止。当我们回到同一页面时,该侦听器的第二个实例也开始运行,现在我的内存/作用域中将有2个调度程序实例。
因此,任何人都知道如何在ngOnDestroy或任何其他地方删除/销毁window.listener !
码:
timerFlag: boolean = true;
private timer;
private sub: Subscription;
ngOnInit() {
this.sub = null;
this.timer = null;
console.log("home-init");
window.addEventListener('blur', this.disableTimer.bind(this), false);
window.addEventListener('focus', this.initializeTimer.bind(this), false);
}
disableTimer() {
if (this.sub !== undefined && this.sub != null) {
this.sub.unsubscribe();
this.timer = null;
}
}
initializeTimer() {
if (this.timerFlag) {
if (this.timer == null) {
this.timer = Observable.timer(2000, 5000);
this.sub = this.timer.subscribe(t => this.runMe()); …Run Code Online (Sandbox Code Playgroud) java ×6
javascript ×2
spring-mvc ×2
ajax ×1
angular ×1
angularjs ×1
collections ×1
css ×1
dao ×1
html ×1
jackson ×1
json ×1
jsp ×1
junit ×1
methods ×1
mysql ×1
null ×1
parameters ×1
postgresql ×1
servlet-3.0 ×1
servlets ×1
spring ×1
spring-amqp ×1
sql ×1
sql-update ×1
testcase ×1
web-services ×1