Help coderanch get a
new server
by contributing to the fundraiser

Amithkumar Kota

Greenhorn
+ Follow
since Jul 26, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Amithkumar Kota

i have small problem. I would appreciate if someone could help me.
I have a contents of a file in a JSP variable and I need to print that content into a textarea this needs to be done only by HTML and JSP.
I know Download of files can be done by multipart request class using servlets. But
1. I need help as to how to download files from the server only by JSP.
2. How to load files from the server on to the browser into a textarea.
this is urgent for my project and any help will be appreciated.
-Amithkumar
22 years ago
This needs to be done only by jsp & html... no javabeans or servlets..
22 years ago
I use orion server on my computer.
i have two frames
i have links on page which should load some text files from the server computer in a particular directory say home/temp/ directory into the other frame in a textarea.
where as all my jsp files are on the orion server.
please tell how this is done....
22 years ago
The application needs to be done without servlets... just jsp and html
22 years ago
Well this is my problem. Can anyone clear my doubt.
I have two frames say frame1 and frame2
"frame1" has a jsp page "jsp1"
"frame2" has a jsp page "jsp2"
and there is an intermediate page "jspx"
form output from page "jsp1" goes to "jspx" and then this data is forwarded to "jsp2"
my question is that what do i need to do
for i want to retain the old data submitted by "jsp1" on "jsp2"
even when new form is submitted
i am attaching the code for all the jsp pages
-----------------------------------jsp1-------------------------

<html>
<%@ page import="java.io.*,java.lang.*" %>
<head>
<% String title="";%>
<body>
<div align="center">
<form method="post" action="save.jsp" target="exright_frame" noscrolling>
<%
String ruleType="none";
String save="none";
String rst="none";
String load="null";
String table="";
String submit="";
String file="";

String data= new String();
ruleType = request.getParameter("rule");
save = request.getParameter("save");
rst = request.getParameter("reset");
load = request.getParameter("load");
data = request.getParameter("area");
file = request.getParameter("file");

%>
<table border="0">
<tr><td>
<input type="reset" name="reset" value= " Reset " >
<input name = "rule" type = "hidden" value = <%= ruleType %> >
<input name = "textdata" type = "hidden" value="area" >
<input name="file" type="text" value="/home/akreddy/temp/" >
<input type="submit" name="save" value="Save" >
</td></tr>
</table>
</form>
<p>
</body>
</html>

-----------------------------------jspx-------------------------
<html>
<%@ page import="java.io.*,java.lang.*" %>
<body>
<div align="center">
<%
String ruletype="none";
String text="none";
String filesave="none";
String areatext= new String();

ruletype = request.getParameter("rule");
filesave = request.getParameter("save");
text = request.getParameter("file");
areatext = request.getParameter("area");
%>
<%! public String SavesFiles(String name, String data)
{

try{FileWriter fw = new FileWriter(name);
PrintWriter pw = new PrintWriter(fw);
pw.println(data);
pw.flush();
pw.close();
fw.close();
return("Rule_Saved!!!");
}
catch (Exception e) {
System.out.println(e);
}
return(" Rule_not_Saved!!! ");
}
%>
-->
<%String hello="null";%>
<%hello=SavesFiles(text,areatext);%>
<jsp:forward page="exright.jsp">
<jsp aram name="rule" type="hidden" value= <%=ruletype%> />
<jsp aram name="file" type="text" value= <%=text%> />
<jsp aram name="soap" type="text" value= <%=hello%> />
</jsp:forward>
</body>
</html>
---------------------------------"jsp2"----------------------
<html>
<body>
<div align="center">
<b>DATABASE OF RULES</b>
<%
String rulename= "null";
String filename="null";
String hello= "null";
rulename = request.getParameter("rule");
filename = request.getParameter("file");
hello= request.getParameter("soap");
%>
<hr>
<form scrolling="no" noresize>
<table border=0 cellpadding=1 cellspacing=0 width="165" bgcolor=maroon width="100%" scrolling="no">
<td valign="top">
<tr><td><font color=FFFFFF><b> Singleton Rules</b></font></td></tr>
</table>
<%if(rulename!=null && filename!=null ) { %>
<% if(rulename.equals("singleton")) { %>
<div align="left">
<a href="list.jsp"><%=filename%></a>
<%}}%>
<br>
<table border=0 cellpadding=1 cellspacing=0 width="165" bgcolor=maroon width="100%" scrolling="no">
<td valign="top">
<tr><td><font color=FFFFFF><b> Point-Wise Rules</b></font></td></tr>
</table>
<%if(rulename!=null && filename!=null ) { %>
<% if(rulename.equals("point")) { %>
<div align="left">
<a href="list.jsp"><%=filename%></a>
<%}%>
<%}%>
<br>
<table border=0 cellpadding=1 cellspacing=0 width="165" bgcolor=maroon width="100%" scrolling="no">
<td valign="top">
<tr><td><font color=FFFFFF><b> Unit Rules</b></font></td></tr>
</table>
<%if(rulename!=null && filename!=null ) { %>
<% if(rulename.equals("unit")) {
%>
<div align="left">
<a href="list.jsp"><%=filename%></a>
<%}}%>
<br>
<table border=0 cellpadding=1 cellspacing=0 width="165" bgcolor=maroon width="100%" scrolling="no">
<td valign="top"></td>
<tr><td><font color=FFFFFF><b> Apply Rules</b></font></td></tr>
</table>
<%if(rulename!=null && filename!=null ) { %>
<% if(rulename.equals("apply")) { %>
<div align="left">
<a href="list.jsp"><%=filename%></a>
<%}}%>
<br>
<table border=0 cellpadding=1 cellspacing=0 width="165" bgcolor=maroon width="100%" scrolling="no">
<td valign="top">
<tr><td><font color=FFFFFF><b> Main Program</b></font></td></tr>
</table>
<%if(rulename!=null && filename!=null ) { %>
<% if(rulename.equals("mainfile")) { %>
<div align="left">
<a href="list.jsp"><%=filename%></a>
<%}%>
<%}%>
<br>
<table border=0 cellpadding=1 cellspacing=0 width="165" bgcolor=maroon width="100%" scrolling="no">
<td valign="top">
<tr><td><font color=FFFFFF><b> MakeFile</b></font></td></tr>
</table>
<%if(rulename!=null && filename!=null ) { %>
<% if(rulename.equals("makefile")) { %>
<div align="left">
<a href="list.jsp"><%=filename%></a>
<%}%>
<%}%>
<br>
<br>
<div align="center">
<!--<input name="Rename" type="text" value="/home/akreddy/temp/">
<input name="Rename" type="Submit" value="Rename File"> -->
<br>
<br>
<br>
<input name="Message" type="button" value= <%=hello%>>
<br>
<br>
<table border=0 cellpadding=1 cellspacing=0 width="165" bgcolor=maroon width="100%" scrolling="no">
<td valign="top">
<tr><td><font color=FFFFFF><b> File Manager</b></font></td></tr>
</table>
<table border=0 cellpadding=0 cellspacing=0 width="150" scrolling="no">
<tr><td width=1 bgcolor=cccccc>
<spacer type=block width=0></td>
<td width=1000>
<table border=0 cellpadding=3 cellspacing=0 width="150" scrolling="no">
<tr><td valign=top>
<a href="manage.jsp" target="exright_frame">Rename Files</a><br>
<a href="manage.jsp" target="exright_frame">Download Outputs</a><br>
<a href="manage.jsp" target="exright_frame">View all Files</a></li><br>
</td>
</tr>
</table>
</td>
</td>
</tr>
</table>
</form>
</body>
</html>
------------------------
-reddy
22 years ago
Well this is my problem. Can anyone clear my doubt
I have 2 frames each one in a different JSP page. Some form inputs are passed from one page to the other and other needs to refresh once they are passed. after refreshing the second frame will display the contents(form text) got from the first frame. If this process is repeated once again I need to retain the info from the first submission.
how can this be done..
<the form input from the first frame need to become static html pages.>
-kota
22 years ago
I am getting the following message when i try to do this to execute using JSP.
/command.jsp.java:11: Incompatible type for declaration. Can't convert java.lang.String to java.lang.Process.
Process p="null";
^
1 error
can anyone please tell me why is this happening and how to correct it...
the code for command.jsp is
<%
String compilefile="none";
String runfile="none";
compilefile = request.getParameter("compile");
runfile = request.getParameter("run");
%>
<%!public String command(String compile){
Process p="null";
BufferedReader inStream = null;
Runtime r = Runtime.getRuntime();
// try executing the command
try {
p = r.exec("make");
return("files compiled");
} catch(IOException e) {
System.out.println("Error executing compile");
}
return(" not compiled");
// read results from process standard output
try {
inStream = new BufferedReader(new InputStreamReader(p.getInputStream()));
System.out.println(inStream.readLine());
return("this is it");
} catch(IOException e) {
System.out.println(e);
}
return("this is not it");

}%>
<% if (compilefile!="null" && runfile=="null"){
command(compilefile);
}
if (compilefile=="null" && runfile!="null"){
command(runfile);
}
%>
-kota
22 years ago
I have a button in jsp and when activated it needs to send message to the command prompt on the server to compile a file.( similar for running a file). code for the button is
<html>
<body>
<div align="center">
<form method="post" action="temp.jsp" enctype="multipart/form-data">
<center>
<h4>Command for compiling the code at the prompt:</h4>
<input name="program" type="text">
<input type="submit" name="compile" value="Compile">
<input type="reset" name="clearform" value="Clear form">
<h4>Command for executing the code at the prompt:</h4>
<input name="program" type="text">
<input type="submit" name="run" value=" Run ">
<input type="reset" name="clearform" value="Clear form">
</center>
</form>
</body>
</html>
what is needed to be written in temp.jsp("the action file") is there any functin for directly for sending text to the command prompt and executing it. if so what is it and how is it done....
22 years ago
<form method="post" action="save.jsp" target="exright_frame">
<textarea name="area" rows=24 cols=75>
class collapse_condition : public singleton_rule {
const_param<int> n, num_iteration ;
param<bool> simulation_finished ;
</textarea>
<input type="reset" name="reset" value= " Reset " >
<input name = "rule" type = "hidden" value = <%= ruleType %> >
<input type="submit" name="save" value="Save" >
</form>
how do i get the contents of the above textarea into another jsp file...with out a submit button... however, i can submit the other input text using save button....does this mean that i get the contents of the textarea to the other jsp file as the form is submitted.....
what do i need to write..
22 years ago