You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Lektroluv <ro...@hotmail.com> on 2010/01/22 23:58:43 UTC
Searching an arraylist
I have a java class called Projects. This class has an arraylist of projects.
Constructor Projects:
public Projects() {
projects = new ArrayList<Project>();
Project s1 = new Project("Something in Java", "group1");
Project s2 = new Project("Something in C++", "group2");
Project s3 = new Project("Something in Ruby", "group3");
projects.add(s1);
projects.add(s2);
projects.add(s3);
}
(Located at src/main/java/...)
Now I want to make a "search engine".
With an input field I can search for a word (1 word) in the project titles.
If this word is found in a project title, the project should be added to a
new list.
At the end, a list of all the projects that contain the searched word should
be listed in the browser.
I will now show the things I have.
welcome.xml:
...
<form action="searchedList.html" method="post">
<p>
Search:
<input name="searchWord"/>
</p>
<input type="submit" value="search"/>
</form>
...
answer.js:
function demo() {
var sw = cocoon.request.get("searchWord");
cocoon.sendPage("screens/answer.html",
{
???
}
);
}
answer.jx.xml:
<?xml version="1.0" encoding="UTF-8"?>
<content>
<h1>Het antwoord</h1>
<p>
Voornaam: #{voornaam}
</p>
<p>
Naam: #{naam}
</p>
</content>
--
View this message in context: http://old.nabble.com/Searching-an-arraylist-tp27281238p27281238.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org