首页 \ 问答 \ 为什么我必须在Tiles子页面片段中重新指定taglib注释?(Why do I have to re-specify taglib annotation in my Tiles child page fragments? (The are already specified in my masterlayout.jsp))

为什么我必须在Tiles子页面片段中重新指定taglib注释?(Why do I have to re-specify taglib annotation in my Tiles child page fragments? (The are already specified in my masterlayout.jsp))

对不起,我不知道如何更好地说出这个问题。

目前,我在主布局中指定了spring mvc“form”taglib注释(以及其他一些注释)。

我希望在这个位置指定这些注释将消除在包含此tile定义的其他页面片段中复制相同注释的需要。

但是,它“出现”,我的“身体”片段似乎只有在我重新指定那里的注释时才能正常工作。

    e.g., 
    <%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
    -
    -
    -

“mypage”的tile定义(基于“masterpage”)看起来像这样

                 -
                 -
                 -
    <definition name="masterpage" template="/WEB-INF/views/masterlayout.jsp">
        <put-attribute name="title" value="" type="string"/>
        <put-attribute name="header" value="" />
        <put-attribute name="leftside" value="" />
        <put-attribute name="rightside" value="" />
        <put-attribute name="footer" value="" />
    </definition>   

    <definition name="mypage" extends="masterpage">
        <put-attribute name="title" value="My Page Title" type="string"/>
        <put-attribute name="header" value="/WEB-INF/views/header.jsp" />  
        <put-attribute name="leftside" value="/WEB-INF/views/leftside.jsp" />        
        <put-attribute name="rightside" value="/WEB-INF/views/rightside.jsp"/>
        <put-attribute name="footer" value="/WEB-INF/views/footer.jsp" />                        
    </definition>
                 -
                 -
                 -

这是masterlayout.jsp的样子

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
    <%@taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>

    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>blah blah blah</title>
            <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/resources/mypage.css" /> 
        </head>
        <body>
            <div>
                <div>
                    <div id="headerdiv">
                        <tiles:insertAttribute name="header" />
                    </div>
                    <div id="middle">
                        <div>
                            <tiles:insertAttribute name="leftside" />
                            <tiles:insertAttribute name="rightside" />
                        </div>
                    </div>
                    <div id="footerdiv">
                        <tiles:insertAttribute name="footer" />
                    </div>
                </div>
            </div>
        </body>
    </html>

这是rightside.jsp页面片段 - 我当前必须重新指定taglibs(没有这些,页面无法正常工作)

    <%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
    <%@taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>

    <div style="min-height: 550px;">
        <div>
            <form:form id="form1" modelAttribute="myViewBean" method="post" action="saveForm.html">
                <form:errors path="errorMsg" cssClass="error" element="div" />                   
                <div class="clear"></div>

                <div>
                    <div class="label">
                        <form:label path="email">Email:<em>*</em></form:label>
                    </div>
                    <div>
                        <form:input path="email" size="40" maxlength="256" />
                        <form:errors path="email" cssClass="error" />   
                    </div>
                    <div class="clear"></div>
                </div>
            </form:form>
        </div>
    </div>

Sorry I dont know how to phrase this question any better.

Currently, I am specifying the spring mvc "form" taglib annotation (and a few others) in my main layout.

I would expect specifying these annotations in this location would eliminate the need to duplicate the same annotations in the other page fragments that comprise this tile definition.

But, it "appears", that my "body" fragment appears to work properly only if I re-specify the annotations there, as well.

    e.g., 
    <%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
    -
    -
    -

the tiles definition for "mypage" (based on "masterpage") looks like this

                 -
                 -
                 -
    <definition name="masterpage" template="/WEB-INF/views/masterlayout.jsp">
        <put-attribute name="title" value="" type="string"/>
        <put-attribute name="header" value="" />
        <put-attribute name="leftside" value="" />
        <put-attribute name="rightside" value="" />
        <put-attribute name="footer" value="" />
    </definition>   

    <definition name="mypage" extends="masterpage">
        <put-attribute name="title" value="My Page Title" type="string"/>
        <put-attribute name="header" value="/WEB-INF/views/header.jsp" />  
        <put-attribute name="leftside" value="/WEB-INF/views/leftside.jsp" />        
        <put-attribute name="rightside" value="/WEB-INF/views/rightside.jsp"/>
        <put-attribute name="footer" value="/WEB-INF/views/footer.jsp" />                        
    </definition>
                 -
                 -
                 -

here is what the masterlayout.jsp looks like

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
    <%@taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>

    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>blah blah blah</title>
            <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/resources/mypage.css" /> 
        </head>
        <body>
            <div>
                <div>
                    <div id="headerdiv">
                        <tiles:insertAttribute name="header" />
                    </div>
                    <div id="middle">
                        <div>
                            <tiles:insertAttribute name="leftside" />
                            <tiles:insertAttribute name="rightside" />
                        </div>
                    </div>
                    <div id="footerdiv">
                        <tiles:insertAttribute name="footer" />
                    </div>
                </div>
            </div>
        </body>
    </html>

Here is the rightside.jsp page fragment - where I currently have to re-specifying taglibs (without these, the page does not work properly)

    <%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
    <%@taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>

    <div style="min-height: 550px;">
        <div>
            <form:form id="form1" modelAttribute="myViewBean" method="post" action="saveForm.html">
                <form:errors path="errorMsg" cssClass="error" element="div" />                   
                <div class="clear"></div>

                <div>
                    <div class="label">
                        <form:label path="email">Email:<em>*</em></form:label>
                    </div>
                    <div>
                        <form:input path="email" size="40" maxlength="256" />
                        <form:errors path="email" cssClass="error" />   
                    </div>
                    <div class="clear"></div>
                </div>
            </form:form>
        </div>
    </div>

原文:https://stackoverflow.com/questions/17980863
更新时间:2022-02-18 10:02

最满意答案

改变你的条件,

if (salt!=null && LogicFacade.authenticate(password, attempted password, salt)){
...if-block
} else {
...else-block
}

由于salt null表示提供的电子邮件不存在于您的数据库中。


Change your if condition to,

if (salt!=null && LogicFacade.authenticate(password, attempted password, salt)){
...if-block
} else {
...else-block
}

As salt null means provided email doesn't exists in your database.

相关问答

更多
  • 在打印带有ab的退出行之前,您的代码A未被锁定。 这意味着当它从睡眠中返回时,它可以做任何想要的事情,因为它不依赖于锁或其他任何东西。 您应该使用信号来阻止其他线程/函数继续。 sleep()只会让处理器放弃指定的时间,然后可以继续。 注意: 你可能不需要睡觉。 如果线程无法获得锁,线程将放弃CPU In your code A is not locked before printing the exit line with ab. This means that when it returns from ...
  • 就像许多UI框架只在一个线程(Windows窗体,WPF ......)中执行所有UI操作一样,大多数布局操作在用户代码执行时被阻止。 为什么? 好吧,当Javascript代码正在执行时,浏览器根本没有响应,因为它的UI线程被占用处理代码。 因此,如果在将控制权放弃到浏览器之前多次更改同一属性的值,则仅保留最后一个值。 当您更改(例如)元素的left值时,如果您可以稍后在同一事件处理程序中更改它,那么通过布局过程将浪费处理能力。 因此,浏览器只是创建一个待处理布局操作的队列,并在没有其他任何操作时执行它们 ...
  • 可能是db.js中的连接很懒? - Petr 3月28日21:56 懒惰他意味着如果你的db.js文件中有这样的东西: mongoose.connect('mongodb://localhost/stack'); 这不是同步的,只是一个挂起的连接。 您可以获取连接并监听打开的事件: var db = mongoose.connection; db.on('error', console.error.bind(console, 'connection error:')); db.once('open', f ...
  • 您的主要问题似乎是@foo = NULL和@foo IS NULL之间存在差异: declare @i int set @i = null -- redundant, but explicit if @i = null print 'equals' if @i is null print 'is' 'This should work'PRINT语句不起作用,因为将NULL与字符串连接会产生NULL,而PRINT NULL不会打印任何内容。 至于实际设置@salerepid的值,似乎很可能插入和/或删除的 ...
  • 你的坐标是倒退的: -public void eraseCircle(Graphics g, int x, int y) -c.eraseCircle(g,temp.getY(),temp.getX()); 切换x和y,它应该工作。 编辑:好吧所以问题是你的坐标中的x和y总是0所以我修改了你的drawCircle方法来返回正确的坐标,你的paint方法来存储它们,所以这就是你得到的: 涂料: public void paint(Graphics g) { int incX = 5; // in ...
  • 改变你的条件, if (salt!=null && LogicFacade.authenticate(password, attempted password, salt)){ ...if-block } else { ...else-block } 由于salt null表示提供的电子邮件不存在于您的数据库中。 Change your if condition to, if (salt!=null && LogicFacade.authenticate(password, attempted passw ...
  • 如果parseRegTask在parseGradesTask之前parseGradesTask ,那么在parseGradesTask的处理程序中, parseGradesTask.getValue()将返回null 。 当然,此值作为courseList传递给fetchRegisterCourseList ,而courseList.stream()将抛出NullPointerException 。 由于每个任务都在自己的线程中运行,这显然是可能的。 我认为您打算在执行程序提供的单个线程上运行这两个任务。 ...
  • 该块未运行,因为您只是block 。 你需要block() ,例如: if let block = _blocks.first as? ()->() { _blocks.removeFirst() _lock.unlock() print("running block...") block() } The block isn't running because you just have block. You need block(), e.g.: if let block ...
  • 这不是bash错误消息; 我在鱼壳的源代码中找到了它: case parse_keyword_else: { this->parse_error(token, parse_error_unbalancing_else, L"'else' builtin not inside of if block"); 这告诉我你正在尝试在source一个bash脚本,但这不会起作用。 source告诉shell(在这种 ...
  • 您必须对代码进行小的更改: For nyear = 0 To nyear = 35 而不是这一行,使用此: For nyear = 0 To 35 You have to do small change in your code: For nyear = 0 To nyear = 35 Instead of this line, Use this: For nyear = 0 To 35

相关文章

更多

最新问答

更多
  • 获取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的基本操作命令。。。