struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davargas123 <davargas...@gmail.com>
Subject Struts HTML taglib vs. Standard HTML tags
Date Fri, 04 Dec 2009 16:31:46 GMT

When I change the standard HTML tags of my .jsp page into the Struts tags,
the page loads up completely blank, aside from what is loaded by the
tiles-def. What could be causing this? I'm thinking that's why my page
doesn't submit data to the actionform, but I don't see why it wouldn't be
rendering the struts tags at all. For instance, if I even add ONE struts tag
in the middle of my working code that isn't the html:form tag, the entire
jsp page will not be rendered at all. It's driving me nuts, I've been
working on figuring this out for far too long and would greatly appreciate
some input.


---------------------------JSP---------------------------------------
<%@taglib uri="/taglib/struts-html" prefix="html"%>
<%@taglib uri="/taglib/struts-bean" prefix="bean"%>
<%@page import="com.thomson.west.pubrec.optout.ui.servlet.SSNLookupAction"
%>
                       
<script>
function encryptSSN(){
        document.ssnLookupForm.submit();
}


function showError(){
        document.getElementById('error').style.display='block';
        document.getElementById('box1').style.display='none';
}

function validateSSN(){
        var ssn = document.ssnLookupForm.ssn.value;
    if( /^\d{3}-\d{2}-\d{4}$/.test(ssn) == false ){
                showError();
    }else{
       encryptSSN();
    }
}
</script>
<html:form method="post" action="/SSNLookupEncrypt">
        <div style="text-align: center; font-family: arial;">
      <div class="productsdiv" style="margin: 0 auto; padding: 5px;
text-align: left; width: 43%">
         <div>
            SSN: <input type="text" name="ssn"
value="<%=ssnLookupForm.getSSN()%>"/>
            <div class="spacer"> </div>
            Format: XXX-XX-XXXX
         </div>
         <div class="spacer"> </div>
         <div style="text-align: center;">
           <input type="button" value="Encrypt" onclick="validateSSN()"/>
         </div>
         <div class="textBox" id="box1" style="text-align: center;
display:block">
         <div class="spacer"> </div>
           Encrypted Value: <%=ssnLookupForm.getEncryptedSSN()%>
       </div>
      </div>
      <div class="spacer"> </div>
   </div>
</html:form>
------------------------------------------------------
This is the corresponding ActionForm:

public class SSNLookupForm extends ActionForm{

        private static Logger log =
              Logger.getLogger(SSNLookupForm.class.getName());
               
        private String ssn = "XXX-XX-XXXX";
        private String encryptedSSN = "[Encrypted Value]";
       
        public String getSSN(){
                return ssn;
        }
       
        public void setSSN(String ssn){
                this.ssn = ssn;
        }
       
        public String getEncryptedSSN(){
                return encryptedSSN;
        }
       
        public void setEncryptedSSN(String encryptedSSN){
                this.encryptedSSN = encryptedSSN;
        }
       
        public void reset(ActionMapping mapping, HttpServletRequest request)
{
            this.ssn = "XXX-XX-XXXX";
            this.encryptedSSN= "[Encrypted Value]";
        }
               
} 
-- 
View this message in context: http://old.nabble.com/Struts-HTML-taglib-vs.-Standard-HTML-tags-tp26635943p26635943.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message