哪一个是最好用的,如果可能的话,请提供这两者的不同之处和优点.
Semantic-ui vs Bootstrap 我正在尝试构建我的UI并且真的很困惑,因为它要使用什么.
请建议我最好的,如果可能的话,举例.
我在request
对象中设置了一个值,如下所示,
String[] categoriesList=null;
categoriesList = engine.getCategoryNamesArray();
request.setAttribute("categoriesList", categoriesList );
Run Code Online (Sandbox Code Playgroud)
这就是我在jsp页面中迭代的方式
<% if(request.getAttribute("categoriesList") != null) { %>
<c:forEach var="categoryName" items="${categoriesList}">
<li><a onclick="getCategoryIndex()" href="#">${categoryName}</a></li>
</c:forEach>
<% }%>
Run Code Online (Sandbox Code Playgroud)
如何获取每个元素的索引并将其传递给JavaScript函数onclick="getCategoryIndex()"
.
我有一个类A,它有一些私有字段,同一个类扩展另一个类B,它也有一些私有字段在A类.
public class A extends B {
private BigDecimal netAmountTcy;
private BigDecimal netAmountPcy;
private BigDecimal priceTo;
private String segment;
private BigDecimal taxAmountTcy;
private BigDecimal taxAmountPcy;
private BigDecimal tradeFeesTcy;
private BigDecimal tradeFeesPcy;
// getter and setter for the above fields
}
Run Code Online (Sandbox Code Playgroud)
而且B级有一些属于A级的私人fiedls
现在,当我尝试从类A上面创建JSON字符串时,我得到以下异常:
class com.hexgen.ro.request.A declares multiple JSON fields named netAmountPcy
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?
因为它们是私有字段,所以在创建json字符串时应该没有任何问题我猜,但我不确定.
我创建json字符串,如下所示:
Gson gson = new Gson();
tempJSON = gson.toJson(obj);
Run Code Online (Sandbox Code Playgroud)
这里obj是A类的对象
键入命令时出现以下错误mvn --version
:
'mvn'不被识别为内部或外部命令,可操作程序或批处理文件.
我也遵循了这一点,但我仍然无法完成工作.
当我输入这个命令时,echo %M2_HOME%
我得到路径打印,因为D:\Program Files\apache-maven-3.0.4
当我键入'echo%M2%'时,我得到了打印的路径D:\Program Files\apache-maven-3.0.4\bin
环境 : Windows XP
我试图使用jQuery动态创建如下的HTML表格:
<table id='providersFormElementsTable'>
<tr>
<td>Nickname</td>
<td><input type="text" id="nickname" name="nickname"></td>
</tr>
<tr>
<td>CA Number</td>
<td><input type="text" id="account" name="account"></td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
这是我的实际表格:
<table border="0" cellpadding="0" width="100%" id='providersFormElementsTable'> </table>
Run Code Online (Sandbox Code Playgroud)
这是将创建tr
和td
元素采取的方法id
和labelText
:
function createFormElement(id, labelText) {
// create a new textInputBox button using supplied parameters
var textInputBox = $('<input />').attr({
type: "text", id: id, name: id
});
// create a new textInputBox using supplied parameters
var inputTypeLable = $('<label />').append(textInputBox).append(labelText);
// append the new radio button and …
Run Code Online (Sandbox Code Playgroud) 我有一个ResultSet,返回不同类型的数据.查询是动态构造的,因此在编译时,我不知道查询将返回什么类型的值.
假设所有结果都是字符串,我编写了以下代码.但我也希望得到每个值的类型.我怎样才能做到这一点?
以下是我编写的代码.
while (reportTable_rst.next()) {
String column = reportTable_rst.getString(columnIterator);
}
Run Code Online (Sandbox Code Playgroud)
此时,我想获取列类型,并根据数据类型获取值.
当我运行Spring MVC应用程序时,我得到此异常并且服务器无法启动.
请帮我解决这个问题.
异常StackTrace:
Jan 24, 2013 11:33:59 AM org.apache.catalina.startup.ContextConfig processAnnotationsJar
SEVERE: Unable to process Jar entry [org/springframework/instrument/classloading/oc4j/package-info.class] from Jar [jar:file:/D:/works/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/dailyship/WEB-INF/lib/spring-context-3.1.0.RELEASE.jar!/] for annotations
java.util.zip.ZipException: invalid LOC header (bad signature)
at java.util.zip.ZipFile.read(Native Method)
at java.util.zip.ZipFile.access$1400(ZipFile.java:56)
at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:677)
at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:413)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
at java.io.DataInputStream.readInt(DataInputStream.java:387)
at org.apache.tomcat.util.bcel.classfile.ClassParser.readID(ClassParser.java:237)
at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:114)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2104)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1980)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1946)
at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1931)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1325)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166) …
Run Code Online (Sandbox Code Playgroud) 我是初学MVC并开始通过做我学到的东西来做一个示例应用程序.我打算在spring MVC中实现Session管理.我发现这个有用.
但我无法清楚地理解它.我们为会话添加值
HttpSession session = request.getSession(false);
session.setAttribute("key", value);
session.setAttribute("key1", value1);
Run Code Online (Sandbox Code Playgroud)
然后我们根据键获取值
session.getAttrubute("key");
Run Code Online (Sandbox Code Playgroud)
但是在春季的MVC中,我看不到任何类似的东西,这让我感到很困惑.
@Controller
@SessionAttributes("thought")
public class SingleFieldController {
@RequestMapping(value="/single-field")
public ModelAndView singleFieldPage() {
return new ModelAndView("single-field-page");
}
@RequestMapping(value="/remember")
public ModelAndView rememberThought(@RequestParam String thoughtParam) {
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("thought", thoughtParam);
modelAndView.setViewName("single-field-page");
return modelAndView;
}
}
Run Code Online (Sandbox Code Playgroud)
在上面的代码 @SessionAttributes("thought")
完全让我感到困惑,就像这个thought
定义的那样,我也没有必要返回,ModelAndView
因为我正在使用backbone.marionette.js
那么如何在会话中设置值并在需要时使用它们?我还必须将会话对象转换为我的用户定义对象,因为在将值返回到屏幕时,我只返回会话中可用的UserDefined对象列表.
所以请帮助我更好地理解它.也许我对使用jsp/servlet的方式感到困惑.
UPDATE
下面是我的控制器并提供了注释
package com.hexgen.puppet;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;
import com.hexgen.puppet.CreatePuppet;
import java.util.ArrayList; …
Run Code Online (Sandbox Code Playgroud) 我在春天有一个使用弹簧安全的Web应用程序,当我尝试执行它所说的应用程序时
This webpage has a redirect loop
Run Code Online (Sandbox Code Playgroud)
这是我security-context.xml
加入后我只有这个例外
<?xml version="1.0" encoding="UTF-8"?>
<b:beans xmlns="http://www.springframework.org/schema/security"
xmlns:b="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<!-- HTTP security configurations -->
<http use-expressions="true">
<form-login login-processing-url="/resources/j_spring_security_check"
login-page="/login" authentication-failure-url="/login?login_error=t" />
<logout logout-url="/resources/j_spring_security_logout" />
<intercept-url pattern="/**" access="isAuthenticated()" />
<intercept-url pattern="/login*" access="permitAll()" />
<intercept-url pattern="/resources/**" access="permitAll()" />
</http>
<!-- Configure Authentication mechanism -->
<authentication-manager alias="authenticationManager">
<authentication-provider>
<user-service>
<user name="admin" password="admin" authorities="RIGHT_LIST,RIGHT_CANCEL,RIGHT_CREATE,RIGHT_UPDATE" />
<user name="antony" password="antony" authorities="RIGHT_LIST,RIGHT_CANCEL,RIGHT_CREATE,RIGHT_UPDATE" />
<user name="rod" password="rod" authorities="RIGHT_LIST,RIGHT_CREATE"/>
</user-service>
</authentication-provider>
</authentication-manager>
<global-method-security secured-annotations="enabled" pre-post-annotations="enabled">
<expression-handler ref="expHandler"/> …
Run Code Online (Sandbox Code Playgroud) 我使用backgrid开发了可编辑网格,它看起来也不错.以下是我的输出:
当我选中复选框并单击delete
图标时,将删除所选行.
现在我也希望每行都有删除选项,以便用户可以直接删除该行.
如何在每一行上添加删除图标.
java ×7
spring-mvc ×3
javascript ×2
apache ×1
backgrid ×1
exception ×1
for-loop ×1
foreach ×1
gson ×1
html-table ×1
httpsession ×1
jdbc ×1
jquery ×1
json ×1
jsp ×1
jstl ×1
marionette ×1
maven ×1
metadata ×1
semantic-ui ×1
session ×1
spring ×1
tomcat7 ×1
windows ×1