我希望尽可能获得最干净的代码,所以要么通过常规的CSS或jQuery.它必须是跨浏览器并在IE中工作.
标记是一个面包屑.
<div id="breadcrumb">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Sports</a></li>
<li><a href="#">Football</a></li>
<li><a href="#">Leagues/a></li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
所以,我想通过3个步骤来设计这个面包屑.
我无法用常规CSS来解决这个问题,因为IE不支持伪类,如:first-child等.
所以我尝试了使用jQuery并取得了一些成功:
$("#breadcrumb li:last > a").addClass("last");
Run Code Online (Sandbox Code Playgroud)
但是我无法弄清楚如何将它们定位在两者之间,因为如果我将所有#breadcrumb li> a设置为类"middle",那么使用.addClass将不再起作用.
有什么建议?
我写了这个简单的例子:
//file TestController.java
public interface TestController {
public List<Test> findAll();
}
//file TestControllerImp.java
@Controller
public class TestControllerImp implements TestController{
@Autowired
private SessionFactory sessionFactory;
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory=sessionFactory;
}
public List<Test> findAll() {
return sessionFactory.getCurrentSession().createQuery("from Test").list();
}
}
//file TestService.java
@Service
public class TestService {
@Autowired
private TestController controller;
public boolean flag=true;
public void setController(TestController controller){
this.controller=controller;
}
@Transactional
public List<Test> useController(){
flag=false;
return controller.findAll();
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的尝试:
TestService s1=context.getBean(TestService.class);
TestService s2=context.getBean(TestService.class);
List<Test> list=s1.useController();
System.out.println(s1.flag+" "+s2.flag);
Run Code Online (Sandbox Code Playgroud)
现在奇怪的行为(即时通讯非常新的春天):
@Transactional …
我在java中编写了一个非常简单的程序,用于使用static关键字.但我得到输出为0.我无法找到原因.我是java的初学者.任何人都可以建议一个解决方案,也请解释为什么遇到这样的问题...我的代码如下:
public class Cube{
static int length;
static int breadth;
static int height;
public static int volume(final int i, final int j, final int k){
return length * breadth * height;
}
public static void main(final String args[]){
System.out
.println("volume of the cube is : " + Cube.volume(10, 20, 30));
}
}
Run Code Online (Sandbox Code Playgroud) 我创建了以下界面
public interface ISolutionSpace {
public boolean isFeasible();
public boolean isSolution();
public Set<ISolutionSpace> generateChildren();
}
Run Code Online (Sandbox Code Playgroud)
但是,在ISolutionSpace
一个名为的类的实现中EightQueenSolutionSpace
,我将返回一组EightQueenSolutionSpace
实例,如下面的存根:
@Override
public Set<ISolutionSpace> generateChildren() {
return new HashSet<EightQueenSolutionSpace>();
}
Run Code Online (Sandbox Code Playgroud)
但是这个存根不会编译.我需要做出哪些改变?
编辑:我也试过'HashSet',并尝试使用extends关键字.但是,由于'ISolutionSpace'是一个接口,并且EightQueenSolutionSpace
是'ISolutionSpace' 的实现(而不是子类),它仍然无法正常工作.
这是一个非常新手的问题:如何使用Spring MVC 3.0.3.RELEASE输出XML?我目前正在使用带有JSTL的Tiles2,当我想输出PDF时,即我只是创建一个扩展AbstractPdfView的视图渲染器,如下所示:
public class PDFOutput extends AbstractPdfView {
@Override
protected void buildPdfDocument(Map<String, Object> model, Document doc,
PdfWriter pdfWriter, HttpServletRequest request, HttpServletResponse response)
throws Exception {
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我应该扩展什么AbstractView类来创建XML文档?
提前致谢,
我正在为我的应用程序使用会话语言环境解析器.我在下拉列表中显示语言.如果用户选择任何一种语言,则重新填充该语言的所有值.
<property name="interceptors">
<list>
<ref bean="localeChangeInterceptor" />
</list>
</property>
<bean id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="languageCode" />
</bean>
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.SessionLocaleResolver" />
Run Code Online (Sandbox Code Playgroud)
但它并没有从会议中读到它.始终从浏览器设置中考虑默认语言.请帮忙.
现在,为了增长知识,我一直在研究简单的字节码检测机制,并希望在我公司未来的项目中使用它们。
我已经浏览了几篇在线文章。但是我对术语“构建时间”和“加载时间”感到困惑。
如果有人澄清这些术语的含义,我将非常感激
谢谢,
努万·阿兰巴奇
我已经使用Spring MVC一段时间了,现在为JSP页面添加了带注释的控制器.我有一个类似这样的类:
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@Controller
public class AdminController {
@RequestMapping(value = "/doStuff1.htm", method = RequestMethod.POST)
public void doStuff1(@RequestParam("password")String password) {
// do some stuff
}
@RequestMapping(value = "/doStuff2.htm", method = RequestMethod.POST)
public void doStuff2(
@RequestParam("password")String password,
@RequestParam("foo")String foo{
// do some stuff
}
}
Run Code Online (Sandbox Code Playgroud)
如您所见,每个调用都会传入密码参数.密码从对话框中读取并传递到每个提交的调用中.
我想从方法调用中删除密码参数以获得"更干净"的代码.
我为此目的快速浏览了Spring安全性,但它似乎有点重量级.也许可以使用AOP?
有一个明显的解决方案我错过了吗?
非常感谢, - 斯科特
春季新手:我有一系列批次
重点是,我没有任何明显的"项目" - 我不想与我的数据中的特定文本行相关,我将它作为一个大块工作,并且不需要任何提交间隔和这样...
但是,我确实希望保持所有这些步骤松散耦合 - 例如,步骤a + b + c可能会成功几天并累积处理过的东西而步骤d一直失败,然后当它最终成功时它会读取并处理所有它的前面步骤的输出.
SO:我的"项目"是一个虚构的"工作项目",它将表示整个新数据?我自己维护一系列队列并在它们之间传递这些虚构的工作项目?
谢谢!
我正在尝试让EclipseLink与Spring(MVC和spring-data)版本3.1.1一起使用,我从一开始就遇到了问题.启动Tomcat(v7.0)时会出现以下错误.我已经搜索了这个错误,但提出的却很少,我不确定下一步该去哪里.在使用具有Entity类的接口时,有一些关于此问题的讨论,但正如您所看到的,我的User.java
类没有任何扩展.
Apr 25, 2012 5:18:34 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Java\jdk1.6.0_29\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Java/jdk1.5.0_22/bin/../jre/bin/server;C:/Java/jdk1.5.0_22/bin/../jre/bin;C:/Java/jdk1.5.0_22/bin/../jre/lib/amd64;C:\oracle\product\10.2.0\client_1\bin;C:\Java\jdk1.5.0_22\bin;c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\windows\system32\windowspowershell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Apache Software Foundation\apache-ant-1.7.0\bin;C:\Program Files\SlikSvn\bin\;C:\JAD;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\maven\apache-maven-3.0.4\bin;C:\eclipse;;.
Apr 25, 2012 5:18:34 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:proxi' did not find a matching property.
Apr 25, 2012 5:18:34 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8980"]
Apr 25, 2012 5:18:34 PM org.apache.coyote.AbstractProtocol init
INFO: …
Run Code Online (Sandbox Code Playgroud) java ×9
spring ×6
spring-mvc ×3
aop ×1
generics ×1
hibernate ×1
jpa ×1
jquery ×1
spring-batch ×1
spring-data ×1
xml ×1