Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 4 Dec 2009 20:33:40 -0000 Issue 8951

user-digest-help

2009-12-04


Author LoginPost Reply

user Digest 4 Dec 2009 20:33:40 -0000 Issue 8951

Topics (messages 204080 through 204100):

Re: RequiredFieldValidator and error message from property file via key
 204080 by: Greg Lindholm

Problem with Struts2 JSON RPC using simple HTTP Post
 204081 by: Prasenjit Bhadra
 204085 by: Musachy Barroso
 204086 by: Frans Thamura
 204090 by: Prasenjit Bhadra
 204091 by: Frans Thamura

Struts HTML taglib vs. Standard HTML tags
 204082 by: davargas123
 204084 by: Mark Shifman
 204087 by: davargas123
 204097 by: davargas123
 204098 by: davargas123
 204099 by: Brian Thompson
 204100 by: davargas123

Re: S2 Type conversion error and validation problem
 204083 by: Marsman

Absolute URL from s:a tag
 204088 by: wkbutler
 204089 by: Chris Pratt

checkbox : unchecked elements not in list
 204092 by: akoo
 204093 by: Brian Thompson
 204094 by: Neil Aggarwal
 204095 by: Colin NG

Re: Help with S:Select
 204096 by: aruna.hcu.gmail.com

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)

----------------------------------------------------------------------


Attachment: user_204080.ezm (zipped)
You may have a different problem then you think;

The @RequiredFieldValidator does not make any sense on a int
(primitive) field as an int cannot be null. The validation interceptor
checks the values on the fields after params interceptor sets the
fields. The RequiredFieldValidator checks if the field is null which
will never be the case for a primitive field.


On Fri, Dec 4, 2009 at 5:25 AM, Per Johansson <perjoha@(protected):
> Hi,
>
> I'm trying to get error messages from a resource bundle.
>
> This is the code for my action class:
>
> @RequiredFieldValidator(type=ValidatorType.FIELD,
> key="myFieldErrorMsg", message="Error!!!!")
> public void setMyField(int myField) {
>    this.myField = myField;
> }
>
> @Override
> public void validate() {
>    if (!isMyFieldValid(myField)) {
>        addFieldError("myField", getText("myFieldErrorMsg"));
>    }
> }
>
> When validation fails for setMyField I don't get the expected error
> message from my resource bundle.
> Instead I get a struts default error message "Invalid field value for field ..."
>
> But when i call getText from the validate method, I get the expected
> error message.
>
> How can I get a message from a resource bundle using the annotation
> based validator?
> I'm using weblogic 10.0.
>
>
> /Best regards, Per Johansson
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


Attachment: user_204081.ezm (zipped)
> I have developed a native client interface which calls struts2 JSON RPC
> using post method. I have set content type, content length as suggested in
> the spec. The request body looks like as follows : {"method":
> "uploadTxpAssignment","id": "txpUploadRequest",
> "params":{"addressByDestAddrId":{"addrLine1":"test home","addrLine2":"7th
> ave","addressId":2,"aptRoomNo":5,"city":"queens","phone":"435-577-4567","state":"NY","zipCode":10183},"atDestTime":null,"callRcvdTime":"2009-11-26T08:01:00","comments":"comments1","dateCreated":"2009-11-26T00:00:00","dateModified":null,"user":{"dateCreated":null,"dateModified":null,"dob":"1956-09-18T00:00:00","firstName":"passfname","gender":"Male","lastName":"patient1lname","mi":null,"ssn":null,"userId":10000}}}
> The struts.xml configurations are : <action name="UploadAction"
> class="com.actions.upload.UploadAction" method="smd"> <interceptor-ref
> name="json"> <param name="enableSMD">true</param> <param
> name="ignoreSMDMethodInterfaces">false</param> </interceptor-ref> <result
> type="json"> <param name="enableSMD">true</param> <param
> name="ignoreInterfaces">false</param> <param
> name="contentType">text/plain</param> <param name="bufferSize">1024</param>
> <param name="allowCaching">false</param> <param
> name="contentCharSet">UTF-8</param> </result> </action> The simple action
> code body : public class UploadCallreportAction { private
> TransportAssignmentVO transport; /** * @return the transport */ public
> TransportAssignmentVO getTransport() { return transport; } /** * @param
> transport the transport to set */ public void
> setTransport(TransportAssignmentVO transport) { this.transport = transport;
> } public String smd() { return Action.SUCCESS; } @SMDMethod public void
> uploadTxpAssignment(TransportAssignmentVO txpVO) { setTransport(txpVO);
> System.out.println("The Tansport assignment is for Run #:"+
> transport.getRunNumber()); } } When I run the client the call reaches the
> server and returns me an exception : :35,013 ERROR [RPCError]
> java.util.HashMap cannot be cast to java.util.List
> java.lang.ClassCastException: java.util.HashMap cannot be cast to
> java.util.List at
> org.apache.struts2.json.JSONInterceptor.invoke (JSONInterceptor.java:204) at
> org.apache.struts2.json.JSONInterceptor.intercept (JSONInterceptor.java:131)
> at
> com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
> at
> org.apache.struts2.impl.StrutsActionProxy.execute (StrutsActionProxy.java:52)
> at
> org.apache.struts2.dispatcher.Dispatcher.serviceAction (Dispatcher.java:488)
> at
> org.apache.struts2.dispatcher.FilterDispatcher.doFilter (FilterDispatcher.java:395)
> I am also using Spring 2.5 and Hibernate JPA in the same app.... Not sure if
> there is any conflict.I have followed the simple rules to set up the JSON
> RPC.However I am not able to resolve the problem. Please let me know if
> anyone has a solution for this.
>
> Jeet
>

Attachment: user_204085.ezm (zipped)
see my previous reply.

On Thu, Dec 3, 2009 at 4:10 PM, Prasenjit Bhadra <prbhadra@(protected):
> I have developed a native client interface which calls struts2 JSON RPC
> using post method. I have set content type, content length as suggested in
> the spec. The request body looks like as follows : {"method":
> "uploadTxpAssignment","id": "txpUploadRequest",
> "params":{"addressByDestAddrId":{"addrLine1":"test home","addrLine2":"7th
> ave","addressId":2,"aptRoomNo":5,"city":"queens","phone":"435-577-4567","state":"NY","zipCode":10183},"atDestTime":null,"callRcvdTime":"2009-11-26T08:01:00","comments":"comments1","dateCreated":"2009-11-26T00:00:00","dateModified":null,"user":{"dateCreated":null,"dateModified":null,"dob":"1956-09-18T00:00:00","firstName":"passfname","gender":"Male","lastName":"patient1lname","mi":null,"ssn":null,"userId":10000}}}
> The struts.xml configurations are : <action name="UploadAction"
> class="com.actions.upload.UploadAction" method="smd"> <interceptor-ref
> name="json"> <param name="enableSMD">true</param> <param
> name="ignoreSMDMethodInterfaces">false</param> </interceptor-ref> <result
> type="json"> <param name="enableSMD">true</param> <param
> name="ignoreInterfaces">false</param> <param
> name="contentType">text/plain</param> <param name="bufferSize">1024</param>
> <param name="allowCaching">false</param> <param
> name="contentCharSet">UTF-8</param> </result> </action> The simple action
> code body : public class UploadCallreportAction { private
> TransportAssignmentVO transport; /** * @return the transport */ public
> TransportAssignmentVO getTransport() { return transport; } /** * @param
> transport the transport to set */ public void
> setTransport(TransportAssignmentVO transport) { this.transport = transport;
> } public String smd() { return Action.SUCCESS; } @SMDMethod public void
> uploadTxpAssignment(TransportAssignmentVO txpVO) { setTransport(txpVO);
> System.out.println("The Tansport assignment is for Run #:"+
> transport.getRunNumber()); } } When I run the client the call reaches the
> server and returns me an exception : :35,013 ERROR [RPCError]
> java.util.HashMap cannot be cast to java.util.List
> java.lang.ClassCastException: java.util.HashMap cannot be cast to
> java.util.List at
> org.apache.struts2.json.JSONInterceptor.invoke (JSONInterceptor.java:204) at
> org.apache.struts2.json.JSONInterceptor.intercept (JSONInterceptor.java:131)
> at
> com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
> at
> org.apache.struts2.impl.StrutsActionProxy.execute (StrutsActionProxy.java:52)
> at
> org.apache.struts2.dispatcher.Dispatcher.serviceAction (Dispatcher.java:488)
> at
> org.apache.struts2.dispatcher.FilterDispatcher.doFilter (FilterDispatcher.java:395)
> I am also using Spring 2.5 and Hibernate JPA in the same app.... Not sure if
> there is any conflict.I have followed the simple rules to set up the JSON
> RPC.However I am not able to resolve the problem. Please let me know if
> anyone has a solution for this.
>
> Jeet
>


Attachment: user_204086.ezm (zipped)
i am glad if we can have a .war with JSON, like show case

make it independent example, we can extend with another tech, such as swing,
jquery, or may be php

F

Attachment: user_204090.ezm (zipped)
Hi guys,

Thanks.This works fine now. I passed the single object instead of an element
of the list.
Have to Wrap the params as a List (i.e; "Params": ["obj1","obj2" ,.....])

This would help us to extend JSON framework with almost any platform as long
as we have a serializing - de-serializing compoent to create a JSON string
and vice-versa.

We have an alternative to Dojo/Ajax implementation. I am using the same from
a mobile platform to create a platform agonostic request`response model :)

Regards,
Jeet


On Fri, Dec 4, 2009 at 11:17 AM, Frans Thamura <frans@(protected):

> i am glad if we can have a .war with JSON, like show case
>
> make it independent example, we can extend with another tech, such as
> swing,
> jquery, or may be php
>
> F
>

Attachment: user_204091.ezm (zipped)
i am succesfully also using DOJO, but never succes using JavaME and Swing

may be u can share with us

we use swing with http client instead JSONRPC




On Sat, Dec 5, 2009 at 1:02 AM, Prasenjit Bhadra <prbhadra@(protected):

> Hi guys,
>
> Thanks.This works fine now. I passed the single object instead of an
> element
> of the list.
> Have to Wrap the params as a List (i.e; "Params": ["obj1","obj2" ,.....])
>
> This would help us to extend JSON framework with almost any platform as
> long
> as we have a serializing - de-serializing compoent to create a JSON string
> and vice-versa.
>
> We have an alternative to Dojo/Ajax implementation. I am using the same
> from
> a mobile platform to create a platform agonostic request`response model :)
>
> Regards,
> Jeet
>
>
> On Fri, Dec 4, 2009 at 11:17 AM, Frans Thamura <frans@(protected):
>
> > i am glad if we can have a .war with JSON, like show case
> >
> > make it independent example, we can extend with another tech, such as
> > swing,
> > jquery, or may be php
> >
> > F
> >
>

Attachment: user_204082.ezm (zipped)

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---------------------------------------
<%@(protected)"%>
<%@(protected)"%>
<%@(protected)"
%>
     
<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]";
    }
         
}


--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_204084.ezm (zipped)
Come on, at least tell us the strut version.

I happen to be using struts 1.3.10 and if you look in
/META-INF/tld/struts-html.tld of the struts-taglib-1.3.10 jar you will find
<uri>http://struts.apache.org/tags-html</uri>

so i use
<%@(protected)"%>

mas

davargas123 wrote:
> 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---------------------------------------
> <%@(protected)"%>
> <%@(protected)"%>
> <%@(protected)"
> %>
>      
> <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]";
>      }
>          
> }
>
>



Attachment: user_204087.ezm (zipped)

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---------------------------------------
<%@(protected)"%>
<%@(protected)"%>
<%@(protected)"
%>
             
<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]";
    }
         
}
--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_204097.ezm (zipped)

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---------------------------------------
<%@(protected)"%>
<%@(protected)"%>
<%@(protected)"
%>
             
<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]";
    }
         
}
--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_204098.ezm (zipped)

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---------------------------------------
<%@(protected)"%>
<%@(protected)"%>
<%@(protected)"
%>
             
<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]";
    }
         
}
--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_204099.ezm (zipped)
Why the triple-post?

On Fri, Dec 4, 2009 at 2:07 PM, davargas123 <davargas123@(protected):

>
> 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---------------------------------------
> <%@(protected)"%>
> <%@(protected)"%>
> <%@(protected)"
> %>
>
> <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-tp26636386p26636386.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_204100.ezm (zipped)
It told me it wasn't sent to the mailing list, I wasn't aware. My apologies.

On Fri, Dec 4, 2009 at 3:30 PM, Brian Thompson <elephantium@(protected):

> Why the triple-post?
>
> On Fri, Dec 4, 2009 at 2:07 PM, davargas123 <davargas123@(protected):
>
> >
> > 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---------------------------------------
> > <%@(protected)"%>
> > <%@(protected)"%>
> > <%@(protected)
> 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-tp26636386p26636386.html
> > Sent from the Struts - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>

Attachment: user_204083.ezm (zipped)


Wes Wannemacher wrote:
>
>
> I would start here -
>
> http://struts.apache.org/2.x/docs/type-conversion.html#TypeConversion-TypeConversionErrorHandling
>
>

Thn*ks for this link. But I've read it before and I'm not should
understanding clearly how to proceed:

"...To keep conversion errors from reporting globally, change the
interceptor stack, and add additional validation rules."

Should I build my own interceptor stack without the conversion error
interceptor and use the type conversion validator only?

Titus


--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_204088.ezm (zipped)

I know this is kind of a silly question. Does anyone know if there is a way
to get the Struts2 'a' tag to emit an absolute URL? Silly or not, I can't
think of any reason for it not to support that, and maybe it's there
already.

Thanks -

--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_204089.ezm (zipped)
forceAddSchemeHostAndPort="true"
(*Chris*)

On Fri, Dec 4, 2009 at 9:54 AM, wkbutler <kent.butler@(protected):

>
> I know this is kind of a silly question. Does anyone know if there is a way
> to get the Struts2 'a' tag to emit an absolute URL? Silly or not, I can't
> think of any reason for it not to support that, and maybe it's there
> already.
>
> Thanks -
>
> --
> View this message in context:
> http://old.nabble.com/Absolute-URL-from-s%3Aa-tag-tp26636169p26636169.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_204092.ezm (zipped)

I have following form

<s:form action="updateAccount">
<s:iterator value="accounts">
<s:property name="account"/>
<s:checkbox name="accountStatus" value=={active}/>

.....
</s:iterator>
</s:form>




In my action class I have following

public UpdateAccount account
{
 List accountStatus;//list to hold all the checkbox values
 List accounts; //list to hold all the accounts values

 // getter setters

 public String execute()
 {
   //iterate through the list of accounts/
   //set account status value to that list accountStatus
 }

}

Ideally I would want the accountStatus list to contains a list of "true" or
"false" strings, however accountStatus list only seems to contains only the
checked
elements...
--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_204093.ezm (zipped)
Unchecked checkboxes in html forms don't submit a value. If you want true
vs. false submitted back to the Java action, you'll need to use radio
buttons.

-Brian

On Fri, Dec 4, 2009 at 12:31 PM, akoo <ogenium@(protected):

>
> I have following form
>
> <s:form action="updateAccount">
> <s:iterator value="accounts">
> <s:property name="account"/>
> <s:checkbox name="accountStatus" value=={active}/>
>
> .....
> </s:iterator>
> </s:form>
>
>
>
>
> In my action class I have following
>
> public UpdateAccount account
> {
>     List accountStatus;//list to hold all the checkbox values
>     List accounts; //list to hold all the accounts values
>
>     // getter setters
>
>     public String execute()
>     {
>           //iterate through the list of accounts/
>           //set account status value to that list accountStatus
>     }
>
> }
>
> Ideally I would want the accountStatus list to contains a list of "true" or
> "false" strings, however accountStatus list only seems to contains only the
> checked
> elements...
> --
> View this message in context:
> http://old.nabble.com/checkbox-%3A-unchecked-elements-not-in-list-tp26636367p26636367.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_204094.ezm (zipped)
> Ideally I would want the accountStatus list to contains a
> list of "true" or
> "false" strings, however accountStatus list only seems to
> contains only the
> checked
> elements...

It looks like you are processing the submitted params
yourself. If that is the case, the browser only gives
you values for the checked boxes. That is an http limitation,
not struts. If you want to do it that way, you will have
to check for the non-presence of unchecked boxes.

Struts will handle the checkboxes correctly if you let it handle
the form submission. On my form bean, I have boolean values
for each of the checkboxes and set the checkbox to use
the field name: <s:checkbox name="myName">
When the user submits the form, everything
works as expected.

Can you do that in your app instead of processing the
request params yourself?

 Neil

--
Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net
Host your struts app on a CentOS VPS for only $25/month!
Unmetered bandwidth = no overage charges, 7 day free trial



Attachment: user_204095.ezm (zipped)

The use "accounts" in s:iterator is wrong. It probably works if you can create something like "new int [7]".

> Date: Fri, 4 Dec 2009 12:50:36 -0600
> Subject: Re: checkbox : unchecked elements not in list
> From: elephantium@(protected)
> To: user@(protected)
>
> Unchecked checkboxes in html forms don't submit a value. If you want true
> vs. false submitted back to the Java action, you'll need to use radio
> buttons.
>
> -Brian
>
> On Fri, Dec 4, 2009 at 12:31 PM, akoo <ogenium@(protected):
>
> >
> > I have following form
> >
> > <s:form action="updateAccount">
> > <s:iterator value="accounts">
> > <s:property name="account"/>
> > <s:checkbox name="accountStatus" value=={active}/>
> >
> > .....
> > </s:iterator>
> > </s:form>
> >
> >
> >
> >
> > In my action class I have following
> >
> > public UpdateAccount account
> > {
> > List accountStatus;//list to hold all the checkbox values
> > List accounts; //list to hold all the accounts values
> >
> > // getter setters
> >
> > public String execute()
> > {
> > //iterate through the list of accounts/
> > //set account status value to that list accountStatus
> > }
> >
> > }
> >
> > Ideally I would want the accountStatus list to contains a list of "true" or
> > "false" strings, however accountStatus list only seems to contains only the
> > checked
> > elements...
> > --
> > View this message in context:
> > http://old.nabble.com/checkbox-%3A-unchecked-elements-not-in-list-tp26636367p26636367.html
> > Sent from the Struts - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
           
_________________________________________________________________
Windows Live: Make it easier for your friends to see what you’re up to on Facebook.
http://go.microsoft.com/?linkid=9691816

Attachment: user_204096.ezm (zipped)
the below code works to make the select option required. If nothing is selected displays the provided message.

<s:select name = "user.department" key = "user.department" headerKey="-1"
        headerValue="-- Please Select --" list="allDepartments" required="true"
        requiredposition="left" />

In validation.xml

<field name="user.department">
      <field-validator type="fieldexpression">
         <param name="expression">!(user.department).equals("1")</param>
         <message>Please select a department.</message>
     </field-validator>
</field>

--
This message was sent on behalf of aruna.hcu@(protected)
http://www.opensubscriber.com/message/user@(protected)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.