struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sajidbigler <sajidbig...@gmail.com>
Subject Ajax functinality works but how to pass parameter to the request ?
Date Wed, 04 Mar 2009 09:33:09 GMT


Hi Friends,

I tried to check whether the user is available or not by using ajax
funtionality as shown below

In action i get parameter "id" but not "username" and i want a event to be
fired onblur to a testfield and using the textfield data i want to check
availability if the user does't exists in database then i want him to go to
next field to do entry and if the user exists in database then i need to
restrict him by asking him to select another username by clearing the
textfield.please help me to accomplish this




<script type="text/javascript">
   
   
   dojo.event.topic.subscribe("/after", function(data, request, widget){
      alert('inside a topic event. after request');
      //data : text returned from request
      //request: XMLHttpRequest object
      //widget: widget that published the topic
   });
</script>


<s:url var="ajaxTest" includeParams="all"  value="/AjaxTest.action">
<s:param name="id" value="%{'22'}" />
 <s:param name="username" value="%{username}" />
</s:url>

<sx:bind id="ex4" href="%{#ajaxTest}" sources="username" targets="username"
events="onblur" afterNotifyTopics="/after" />

<s:textfield label="User Name" name="username" required="true"
requiredposition="left" id="username" />

public class AjaxTestForUserNameAvailability   extends ActionSupport{
	    private String username;
	   private boolean exist;
	    public String execute(){
	        if(this.getUsername().equals("Admin")){
	            this.setExist(true);
	       }
	      else{
	           this.setExist(false);
	       }
	        return SUCCESS;
	    }

	 }
-- 
View this message in context: http://www.nabble.com/Ajax-functinality-works-but-how-to-pass-parameter-to-the-request---tp22326366p22326366.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