File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes AutoComplete YUI please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "AutoComplete YUI please help" Watch "AutoComplete YUI please help" New topic
Author

AutoComplete YUI please help

Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
i looked through the link below but did not understand, how to start off
----
Link
----
http://developer.yahoo.com/ypatterns/pattern.php?pattern=autocomplete


Please help!!!
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684

HI,

If you want to Autocomplete Example you find Struts 2.0 tag for Autocomplete .

See example of Struts2.0 Showcase.

Thanks,
Nishan Patel.


Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
u mean the autocompleter tag right?
i tried that did not work....can you tell me how to do it?
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684

Hi,

I am giving you simple jsp for this Example .


////////////////////////////////////////////////

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'autocompleter.jsp' starting page</title>
<s:head theme="ajax" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>

<body>
<h1>Struts 2 Autocompleter Example!</h1>
<s:label name="stateName" value="Select State Name:" />
<s:autocompleter theme="ajax" list="state" name="StateName"/>
</body>
</html>

////////////////////////////////////////////

stateName - is a list name contains State name.

<s:head theme="ajax" /> please make sure your jsp contain this tag.



Thanks,
Nishan Patel.
Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
This is the code snippet i used:
/////////////
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<head>

<base href="<%=basePath%>">

<title><s:text name="section.cataloging" /></title>

<meta name="section" content="cataloging" />
<meta name="theme" content="xhtml" />
<meta name="prototypejs" content="true" />
<meta name="scriptaculousjs" content="true" />
<s:head theme="ajax" />
</head>



<body>
<display:column titleKey="title.language" sortable="true" sortProperty="language">
<s:if test="%{#attr.work_queue.isBilled != 'true'}">
<s:autocompleter id="lng_%{#attr.work_queue.itemId}" list="languages"
onchange="updateLanguage('%{#attr.work_queue.itemId}',this.value);"
cssStyle="width:75px;" name="title.language" theme="ajax"
listKey="code" listValue="description" value="%{#attr.work_queue.language}" />
</s:if>
<s:else>
<h:language code="${work_queue.language}" />
</s:else>
</display:column>

</body>

what mistake have i done here?
Am i missing any configurations?
Please let me know.....
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684

Hi,

First of all in display tag you can not use Struts tag.

So, first remove your display tag and again use this code.


Thanks,
Nishan Patel.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AutoComplete YUI please help
 
Similar Threads
Is Ajax slow?
Implementing previous searches
AutoSuggest drop down using Ajax
Code for autocomplete
Autocomplete textbox using AJAX