2013-06-26 2 views
1

안녕하세요. Struts를 처음 접했고 간단한 등록 앱을 만드는 중이었습니다.(Struts) 키 "registration.jsp.title"에 대한 누락 된 메시지

다음은 내 index.jsp 파일

index.jsp입니다 :

<%@ page contentType="text/html;charset=UTF-8" language="java" %> 

<%@ taglib uri="/tags/struts-bean" prefix="bean" %> 
<%@ taglib uri="/tags/struts-html" prefix="html" %> 
<%@ taglib uri="/tags/struts-logic" prefix="logic" %> 

<html:html> 

<head> 
    <title><bean:message key="registration.jsp.title"/></title> 
    <style type="text/css"> 
     .error { color: red; font-weight:bold } 
    </style> 
</head>  
<body> 

    <h1><bean:message key="registration.jsp.heading"/></h1> 

    <logic:present name="registration-successful" scope="request"> 
     <h2>  
      <bean:message key="registration.jsp.registration-successful"/> 
      <bean:write name="registration-successful" property="userid" /> 
     </h2> 
    </logic:present> 

    <logic:notPresent name="registration-successful" scope="request"> 
     <html:form action="Registration.do" focus="userid"> 

      <dl> 
       <dt><bean:message key="registration.jsp.prompt.userid"/></dt>    
       <dd> 
        <html:text property="userid" size="20" /> 
        <span class="error"><html:errors property="userid" /></span> 
       </dd> 

       <dt><bean:message key="registration.jsp.prompt.password"/></dt>    
       <dd> 
        <html:text property="password" size="20" /> 
        <span class="error"><html:errors property="password" /></span>  
       </dd> 

       <dt><bean:message key="registration.jsp.prompt.password2"/></dt>    
       <dd><html:text property="password2" size="20" /></dd> 

       <dt><html:submit property="submit" value="Submit"/> 
        <html:reset/> 
       </dt>    
      </dl> 

     </html:form> 
    </logic:notPresent> 

</body> 
</html:html> 

내가 /WEB-INF/resources 폴더 에 포함 된 내 Application.properties 파일을 데 다음은 struts-config.xml입니다 :

<?xml version="1.0" encoding="ISO-8859-1" ?> 

<!DOCTYPE struts-config PUBLIC 
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" 
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> 

<struts-config> 

<form-beans> 
    <form-bean name="RegistrationForm"    
type="net.thinksquared.registration.RegistrationForm"/>   
</form-beans> 

<action-mappings> 

    <action path="/Registration" 
      type="net.thinksquared.registration.RegistrationAction" 
      name="RegistrationForm" 
      scope="request" 
      validate="true" 
      input="/index.jsp"> 

     <forward name="success" path="/index.jsp"/> 

    </action> 

</action-mappings> 

<message-resources parameter="Application"/> 

</struts-config> 
+1

Struts를 처음 사용하는 경우 [공식적으로 EOL 된] 버전 (http://struts.apache.org/struts1eol-announcement.html)으로 시작하는 이유는 무엇입니까? 어쨌든 속성 파일과 파일의 위치를 ​​포함하지 않고 누락 된 키에 대한 질문을하면 도움을받을 수 없습니다. –

답변

0

당신은 src 폴더에 Application.properties 파일이 있어야합니다. 이 등록 정보 파일에는 <bean:message> 태그를 통해 JSP에서 가져 오는 키 - 값 쌍의 메시지가 있어야합니다. 예를

registration.jsp.title = My registration title 

위해 당신은 태그의 key 속성을 사용하여 파일에서 고유해야 키에 의해이 메시지를 검색 할 수 있습니다.

관련 문제