You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Vaideesh Natarajan (JIRA)" <ji...@apache.org> on 2009/10/08 19:25:50 UTC

[jira] Created: (WW-3280) Similar issue with loadMinimumCount="1"

Similar issue with loadMinimumCount="1"
---------------------------------------

                 Key: WW-3280
                 URL: https://issues.apache.org/struts/browse/WW-3280
             Project: Struts 2
          Issue Type: Sub-task
    Affects Versions: 2.0.14
         Environment: OS : Windows Vista Home Basic
IE 8.0.6001.18813IC
Struts 2.0.14
            Reporter: Vaideesh Natarajan
            Assignee: Musachy Barroso
            Priority: Critical


I am using the autocompleter as below

<s:url id="iauJSON" value="/atp/projects/ItemMasterEntityAttribute/auto.action?fldType=iau"/>

<s:autocompleter theme="ajax" href="%{iauJSON}" name="userName"
   keyName="userId" loadOnTextChange="true" autoComplete="true" 
   loadMinimumCount="1" showDownArrow="false"  dropdownHeight="100" size="17" 
   cssClass="input" cssStyle="position: relative;top: 1; height:17px;"/>

when I press a letter say 'a', I don't see anything even though loadMinimumCount is set to 1, then if I press <backspace> and press 'a' again, it works fine, same thing happens for all the letters. if I press 2 letters say 'al' it works fine(provided ofcourse the likes of it exist in the table) 

I would really appreciate a patch as I can't upgrade to 2.1 yet. Even a pointer to a similar issue reported before would be very helpful as I couldn't any myself. Please help! Thanks~

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-3280) Similar issue with loadMinimumCount="1"

Posted by "Vaideesh Natarajan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-3280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46911#action_46911 ] 

Vaideesh Natarajan commented on WW-3280:
----------------------------------------

Hi .. Thanks for such a quick reply. I found the issue, the issue is in the initialization. I just have a question now and would really appreciate a reply. My username field has close to 9000 records and when the page is loading I was not querying the database in my auto method in my Action class and returning just an empty hashmap, turns out that is the problem. It is designed such that unless I do a select all query while loading the page from the database and each time I type in anything in the field I won't get my desired output. Isn't this a performance hassle? 

I have impletemented it the autocompleter as below, please answer my concern about the performance. If say the number of users go upto 100000 in a few months, wouldn't that be a major performance hassle, if the only way to make this work is to do a select all query each time I key in anything in my user name field? If there is any work around, please let me know. Thanks in advance for your help!

JSP Page
========
<s:url id="iauJSON" value="/atp/projects/ItemMasterEntityAttribute/auto.action?fldType=iau"/> 

<s:autocompleter theme="ajax" href="%{iauJSON}" name="userName" 
   keyName="userId" loadOnTextChange="true" autoComplete="true" 
   loadMinimumCount="1" showDownArrow="false" dropdownHeight="100" size="17" 
   cssClass="input" cssStyle="position: relative;top: 1; height:17px;"/> 

Action Class
==========
public String auto() throws Exception { 		
try {
         Map<String,String> json = null;
         String fildType = req.getParameter("fldType");
         String likeChar="dontfindanything";
         if("iau".equals(fildType)){
             if(StringUtils.isEmpty(userName)){
                           likeChar="dontfindanything";
              }else{
                      likeChar=userName;
              }
         }
         json = personDao.getPersonAutoComplete(likeChar);
         JSONObject results = new JSONObject(json);
         req.setAttribute(AUTO_REQUEST_KEY, results.toString());
      } catch (Exception exc) {
           exc.printStackTrace();
      }
      return Forwards.AUTO;
}
DAO Class
=========
public Map<String,String> getPersonAutoComplete(String likeChar)throws DaoException {
	Map<String,String> json = new HashMap<String,String>();
	String query ="select user_id , user_name from users where user_name like '"+likeChar+"%' order by user_name ";
	if("dontfindanything".equals(likeChar))
		return json;
	if("*".equals(likeChar))
		query ="select person_id as value, user_name as label from person order by user_name ";
	Session sess = getHibernateSession();
	try {
		List<Object[]> list = sess.createSQLQuery( query ).list();
		if ((list != null) && (list.size() > 0)) {
			for (Object[] obj : list) {
				if(obj!=null){
					json.put(obj[0]==null?"":(String)(obj[0]+""), obj[1]==null?"":(String)obj[1]);
				}					
			}
		}
	} finally {
		closeHibernateSession();
	}
	return json;
}

> Similar issue with loadMinimumCount="1"
> ---------------------------------------
>
>                 Key: WW-3280
>                 URL: https://issues.apache.org/struts/browse/WW-3280
>             Project: Struts 2
>          Issue Type: Sub-task
>    Affects Versions: 2.0.14
>         Environment: OS : Windows Vista Home Basic
> IE 8.0.6001.18813IC
> Struts 2.0.14
>            Reporter: Vaideesh Natarajan
>            Assignee: Musachy Barroso
>            Priority: Critical
>
> I am using the autocompleter as below
> <s:url id="iauJSON" value="/atp/projects/ItemMasterEntityAttribute/auto.action?fldType=iau"/>
> <s:autocompleter theme="ajax" href="%{iauJSON}" name="userName"
>    keyName="userId" loadOnTextChange="true" autoComplete="true" 
>    loadMinimumCount="1" showDownArrow="false"  dropdownHeight="100" size="17" 
>    cssClass="input" cssStyle="position: relative;top: 1; height:17px;"/>
> when I press a letter say 'a', I don't see anything even though loadMinimumCount is set to 1, then if I press <backspace> and press 'a' again, it works fine, same thing happens for all the letters. if I press 2 letters say 'al' it works fine(provided ofcourse the likes of it exist in the table) 
> I would really appreciate a patch as I can't upgrade to 2.1 yet. Even a pointer to a similar issue reported before would be very helpful as I couldn't any myself. Please help! Thanks~

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WW-3280) Similar issue with loadMinimumCount="1"

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-3280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso resolved WW-3280.
---------------------------------

    Resolution: Won't Fix

the dojo plugin is deprecated and we won't be fixing anymore bugs on it

> Similar issue with loadMinimumCount="1"
> ---------------------------------------
>
>                 Key: WW-3280
>                 URL: https://issues.apache.org/struts/browse/WW-3280
>             Project: Struts 2
>          Issue Type: Sub-task
>    Affects Versions: 2.0.14
>         Environment: OS : Windows Vista Home Basic
> IE 8.0.6001.18813IC
> Struts 2.0.14
>            Reporter: Vaideesh Natarajan
>            Assignee: Musachy Barroso
>            Priority: Critical
>
> I am using the autocompleter as below
> <s:url id="iauJSON" value="/atp/projects/ItemMasterEntityAttribute/auto.action?fldType=iau"/>
> <s:autocompleter theme="ajax" href="%{iauJSON}" name="userName"
>    keyName="userId" loadOnTextChange="true" autoComplete="true" 
>    loadMinimumCount="1" showDownArrow="false"  dropdownHeight="100" size="17" 
>    cssClass="input" cssStyle="position: relative;top: 1; height:17px;"/>
> when I press a letter say 'a', I don't see anything even though loadMinimumCount is set to 1, then if I press <backspace> and press 'a' again, it works fine, same thing happens for all the letters. if I press 2 letters say 'al' it works fine(provided ofcourse the likes of it exist in the table) 
> I would really appreciate a patch as I can't upgrade to 2.1 yet. Even a pointer to a similar issue reported before would be very helpful as I couldn't any myself. Please help! Thanks~

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.