• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsp & HTML

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn�t look at all your code but seems like you can do it using the setAttributte, and getAttributte storing the variables in the session and then recovering it.
 
Amithkumar Kota
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The application needs to be done without servlets... just jsp and html
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can still use a session object from JSP's, it doesn't require a servlet.

In your jspx, you would add the submitted values to the session.

Then in jsp2, you would retrieve them from the session.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic