首页 \ 问答 \ 这可能与HTML?(Is this possible with HTML?)

这可能与HTML?(Is this possible with HTML?)

我需要在网站中实施菜单卡。 我的顾客想要的是,它看起来就像在餐厅的卡片上。

是否可以在HTML文本中直接放置边框线,如下图所示(“Hauptgerichte”)? 如果是的话,我怎么能意识到这一点?

在这里输入图像描述

谢谢!


I need to implement a menucard in to a website. My customer wants, that it looks exactly like on the card in the restaurant.

Is it with HTML possible to put a border-line directly under the text like on the image below ("Hauptgerichte")? And if yes, how could I realize that?

enter image description here

Thanks!


原文:https://stackoverflow.com/questions/15960226
更新时间:2023-03-12 16:03

最满意答案

使用standaloneSetup您所做的只是执行特定控制器的设置。

如果您不想配置整个应用程序上下文(使用webAppContextSetup而不是standaloneSetup ),可以通过将代码更改为:手动设置异常处理程序:

 @Before
 public void setup() throws IOException {
     MockitoAnnotations.initMocks(this);
     mockMvc = MockMvcBuilders.standaloneSetup(controller).setHandlerExceptionResolvers(new ExceptionHandlerExceptionResolver()).build();
 }

 @Test
 public void test() throws Exception {
     mockMvc.perform(get("/verifyCert.controller").contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)).andExpect(status().isForbidden());
 }

这是有效的,因为ExceptionHandlerExceptionResolver是Spring MVC用于处理基于@ExceptionHandler注释的异常的类

查看我的一个较旧的相关答案,其中涵盖了一个更加困难的案例(在包含@ExceptionHandler的类上使用@ControllerAdvice )。


When using standaloneSetup all you are doing is performing the setup for the specific controller.

If you don't want to configure the whole application context (which you would do with webAppContextSetup instead of standaloneSetup), you can manually setup the exception handler by changing your code to:

 @Before
 public void setup() throws IOException {
     MockitoAnnotations.initMocks(this);
     mockMvc = MockMvcBuilders.standaloneSetup(controller).setHandlerExceptionResolvers(new ExceptionHandlerExceptionResolver()).build();
 }

 @Test
 public void test() throws Exception {
     mockMvc.perform(get("/verifyCert.controller").contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)).andExpect(status().isForbidden());
 }

This works because ExceptionHandlerExceptionResolver is the class that Spring MVC uses to handle exceptions based on the @ExceptionHandler annotation

Check out one of my older relevant answers that covers an ever more difficult case (the use of @ControllerAdvice on a class that contains @ExceptionHandler).

相关问答

更多
  • exception handler 异常处理; 异常处理程序; 异常处理例程 Secondly, all errors or unexpected warnings really should be handled by theexception handler. 其次,所有错误或意想不到的警告实际上应该由异常处理程序来处理。
  • 您需要确定Spring的响应媒体类型应该如何确定。 这可以通过几种方式完成: 路径扩展(例如/image.jpg) 网址参数(例如?格式= jpg) HTTP Accept头(例如Accept:image / jpg) 默认情况下,Spring查看扩展而不是Accept头。 如果您实现扩展WebMvcConfigurerAdapter的@Configuration类,则可以更改此行为。 在那里你可以重写configureContentNegotiation(ContentNegotiationConfigu ...
  • 添加一个中断点并不是真正的单元测试,实际上根本不是测试。 你可以称它为检查,但没有检查驱动开发这样的事情。 总之,单元测试的新手经常会发现这个问题,他们想测试私有或本地值让它成为一个变量或方法。 当我开始TDD时,我自己实际上已经相当分阶段了。 但事情是,在单元测试中,目的是对特定功能和所有可能的结果进行黑盒测试。 那个黑匣子里面发生的事情不是你关心的,也不需要单元测试它。 如果你想测试一个中间值,那么你的方法可能太长,应该分解成两个或更多可测试的小方法。 如果它不能完成,那么你不应该担心测试它们。 如果这 ...
  • 谢谢大家的意见。 让我试着根据评论回答我的问题。 这是新的测试: public void testProperties() { assertThat(Helper.properties(), is(notNullValue())); } 我将简单地测试以确保该方法不返回空值。 如果方法返回非null值,则它将是Properties的实例。 这意味着无需测试方法是否返回Properties的实例。 Thanks all for your comments. Let me try to answer ...
  • Spring:RESTful控制器和错误处理帮助了我,我的问题是缺少这个: @Component public class AnnotatedExceptionResolver extends AnnotationMethodHandlerExceptionResolver{ public AnnotatedExceptionResolver() { setOrder(HIGHEST_PRECEDENCE); } } Spring: RESTful controllers and erro ...
  • 使用standaloneSetup您所做的只是执行特定控制器的设置。 如果您不想配置整个应用程序上下文(使用webAppContextSetup而不是standaloneSetup ),可以通过将代码更改为:手动设置异常处理程序: @Before public void setup() throws IOException { MockitoAnnotations.initMocks(this); mockMvc = MockMvcBuilders.standaloneSetup(c ...
  • 默认情况下,所有$exceptionHandler都使用给定参数登录到控制台: function $ExceptionHandlerProvider() { this.$get = ['$log', function($log) { return function(exception, cause) { // .apply means delegate the arguments $log.error.apply($log, arguments); // just del ...
  • 为了单元测试这个自定义的异常处理程序,创建sut / mut所需的依赖关系,并运行测试来验证预期的行为。 这是一个简单的例子,让你开始。 [TestClass] public class CustomExcpetionhandlerUnitTests { [TestMethod] public void ShouldHandleException() { //Arrange var sut = new CustomExceptionHandler(); ...
  • 再次抛出异常,由DefaultHandlerExceptionResolver处理,以响应web.xml中定义的错误页面; 它不会调用控制器的相同异常处理程序。 @ExceptionHandler(Exception.class) public ModelAndView generateException(Exception ex) throws Exception{ if(condition) { return new ModelAndView("myError.jsp"); ...
  • 哎呀,如果你的JNI崩溃了JVM,那么从junit开始测试肯定会很困难。 例如,你不能为SIGSEGV连接一个信号处理程序,JVM就会死掉。 如果是我,我会稍微更改一下并创建一个简单的Java类,其中Main调用崩溃的本机代码,在我的junit测试中,我将执行一个运行该包装类的Java运行时的新实例运行#EXEC。 然后,您可以等待生成的进程完成并检查其返回代码 - 如果它不为零,则执行时出现问题。 Ouch, if your JNI is crashing the JVM, then that's cer ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。