struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sunil_S...@Keane.com
Subject Re: how to deal with request attributes and validation?
Date Fri, 12 May 2006 09:19:37 GMT
Dario,

In this situation, in the "input" attribute of action-mapping, you should 
provide the action-mapping which you want to execute to populate your 
drop-down in jsp. Usually we provide the JSP page in "input" attribute, 
but when you have to forward to JSP through any action, you should provide 
one more attribute in struts-config.xml file. In Controller tag, 
"inputForward" attribute should be set as "true", by default it is 
"false". In case of "false" value, you can not use action-mapping in 
"input" attribute, but in case of "true", you can.
Consider following example..

    <action
        path="/trade"
        type="com.mypkg.depository.action.DepositoryAction"
        input="failure"
                name="depositoryForm"
        scope="request"
        parameter="method"
        validate="true" >
      <forward name="success" 
path="/viewdepository.do?method=viewDepository"/>
      <forward name="failure" path="/loadtrade.do?method=loadTrade"/>
    </action>

   <controller 
processorClass="org.springframework.web.struts.DelegatingTilesRequestProcessor" 
nocache="false" inputForward="true" maxFileSize="2M"/>


Hope it helps.....

Thanks & Regards
Sunil Sahu




dario <darionis@yahoo.com> 
05/12/2006 02:05 PM
Please respond to
Struts Users Mailing List <user@struts.apache.org>


To
user@struts.apache.org
cc

Subject
 how to deal with request attributes and validation?






hello everybody, 
I'd like to know how do you deal with situations where you need to 
display some dynamic elements (menus, dropdowns...) on the page? 
putting those in the request scope in the action thus making them 
available to JSP, seems most naturally to me. problem is when form data 
does not pass validation, and action is never called, so JSP page breaks 
because it has no data to display. 
is there any proven tactics for this? basicly, i want some action/method 
executed even if validation fails, but still want validation to work and 
error messages passed to JSP. 
thanks a lot! 

dario 

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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message