玉兰的英文
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了玉兰的英文相关的知识,希望对你有一定的参考价值。
yulan magnoliamagnolia 是兰花的意思 可能是外国没有玉兰 所以它的英文名在兰花的单词前加中文拼音 参考技术A Magnolia
玉兰花是如何完成请求映射的?
【中文标题】玉兰花是如何完成请求映射的?【英文标题】:How request mapping is done in magnolia blossom? 【发布时间】:2015-03-30 11:18:58 【问题描述】:这是我拥有的以下控制器代码:
package com.newposition.templates.components;
import javax.jcr.Node;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import info.magnolia.module.blossom.annotation.Template;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
.......
.......
@Controller
@Template(title = "Login Form", id = "newPositionModule:components/login")
public class LoginFormComponent
@Autowired
private LoginServiceImpl loginServiceImpl;
/*@RequestMapping(value = "/", "/welcome**" , method = RequestMethod.GET)
public String defaultPage()
ModelAndView model = new ModelAndView();
model.addObject("title", "Spring Security + Hibernate Example");
model.addObject("message", "This is default page!");
model.setViewName("home");
return "components/loginSucess.jsp";
*/
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String render(@ModelAttribute LoginForm loginForm,HttpServletRequest request)
return "components/loginForm.jsp";
@RequestMapping(value = "/login", method = RequestMethod.POST)
public ModelAndView rendering( @ModelAttribute("loginForm") @Valid LoginForm loginForm,BindingResult result,HttpServletRequest request)
String viewName = "";
String user=loginServiceImpl.verifyLogin(loginForm);
if(user!=null)
request.getSession().setAttribute("valid", true);
request.getSession().setAttribute("user", user);
request.getSession().setAttribute("authenticate", false);
viewName = "components/loginSucess.jsp";
return new ModelAndView(viewName);
else
request.getSession().setAttribute("authenticate", true);
viewName = "components/loginForm.jsp";
return new ModelAndView(viewName);
下面这个Jsp:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib
uri="http://magnolia-cms.com/taglib/templating-components/cms"
prefix="cms"%>
<%@ taglib
uri="http://magnolia-cms.com/taglib/templating-components/cmsfn"
prefix="cmsfn"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="blossom-taglib" prefix="blossom"%>
<c:if test="$authenticate">
<b style="color:red; margin-left:560px" align="center">Please Enter a Valid Credentials</b>
</c:if>
<form:form id="loginform" action="?" commandName="loginForm" method="POST">
<blossom:pecid-input />
<div class="container">
<ul class="login_box">
<li>
<div class="form-group">
<form:input path="firstName" id="username" placeholder="Username" class="form-control"/>
</div>
<div class="form-group">
<form:password path="password" id="password" placeholder="Password" class="form-control"/>
</div>
<div class="form-group">
<button class="lgn_btn" type="submit" onsubmit="return validateForm()">Login</button>
</div>
<hr>
<div class="form-group">
<button class="lgn_btn" type="submit">Register as a new
user</button>
</div>
<a href='resetpassword'><button class="lgn_btn" type="button">Reset password</button></a>
</li>
</ul>
</div>
</form:form>
当表单提交时,请求将转到上面的控制器 post 方法。
在jsp中有"form action="?""
那么它是如何映射到特定控制器方法的。
请提出建议。
【问题讨论】:
【参考方案1】:我相信最近回答了同样的问题here 它将被提交到呈现表单的同一页面,并最终在同一个 Spring Controller 中。
【讨论】:
以上是关于玉兰的英文的主要内容,如果未能解决你的问题,请参考以下文章