dexter.deepak
June 26th, 2008, 04:26 PM
i am trying to make a simple wiki (yesss ..with lot of flaws too :)) through jsp on the apache-tomcat architecture,
the purpose is described : (i am using file-handling here)
1. there's a folder named wiki, in which all the user created pgs reside.
2. the user gives a name "wname" for the new page he wants to create and saves it in the directory.
3. the jsp then looks for the word "wname" in all the pages in the wiki directory , and replaces all these entries :
wname ----> <a href=wname.jsp>wname</a>
till now i was planning to call a shell script from the jsp:
sed -i "s/$2/$3$2$4/g" $1
in the script should do the task...here's a part of jsp :
<% String bash=("sh "+"path_to_script "+"path_to_wiki_dir "+wname+" <a href="+wname+".jsp "+"<\\/a>");
try
{
Process proc = Runtime.getRuntime().exec(bash);
but the script doesnt seem to work :(
i later on think read about the StringBuffer class and thought it was a foolish idea to call a shell script from jsp.
what i need ..
some messiah who can either help me run the script ...which is not even running properly on a standalone basis OR help me write a java code equivalent to sed in that script.
the purpose is described : (i am using file-handling here)
1. there's a folder named wiki, in which all the user created pgs reside.
2. the user gives a name "wname" for the new page he wants to create and saves it in the directory.
3. the jsp then looks for the word "wname" in all the pages in the wiki directory , and replaces all these entries :
wname ----> <a href=wname.jsp>wname</a>
till now i was planning to call a shell script from the jsp:
sed -i "s/$2/$3$2$4/g" $1
in the script should do the task...here's a part of jsp :
<% String bash=("sh "+"path_to_script "+"path_to_wiki_dir "+wname+" <a href="+wname+".jsp "+"<\\/a>");
try
{
Process proc = Runtime.getRuntime().exec(bash);
but the script doesnt seem to work :(
i later on think read about the StringBuffer class and thought it was a foolish idea to call a shell script from jsp.
what i need ..
some messiah who can either help me run the script ...which is not even running properly on a standalone basis OR help me write a java code equivalent to sed in that script.