File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

calling JSP n times with Different Inputs stored in a Session

 
Ven Mahi
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I Have an application which makes use of an object stored in a Session.
a JSP ex1.jsp includes ex2.jsp(Which will create the object if it is not session and adds it to the session) will produce the html file using the object in the session.
Q1: Now i want to loop through 10 times by changing one of the values of Object stored in the session with out recreating that every time and using ex1.jsp produce results and save it or print it and display the last Results Page
How can i do that, saving, printing, calling same jsp repeatedly using the object in session
[ June 14, 2002: Message edited by: Ven Mahi ]
 
Ven Mahi
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any One!!! Help me. I tried the following code but it is not using the values in the session, it is creating a new object ( I check for this another included jsp , if not found in session create new one )every time i call this function from JSP
URL u = new URL("http://localhost:8080/loop.jsp");
URLConnection urlc;
for(int i=0; i< 4;i++)
{
myObject.setItem("MyItem", "MyItem"+i);
urlc = u.openConnection();
urlc.setDoInput(true);
urlc.setDoOutput(true);
urlc.setAllowUserInteraction(true);
DataInputStream in = new DataInputStream(urlc.getInputStream());
pt = new PrintWriter(new FileOutputStream("abcd"+i+".html"));
String s;
while((s = in.readLine()) != null)
{
pt.println(s);
}
[ June 17, 2002: Message edited by: Ven Mahi ]
 
Ven Mahi
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any one???
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps you are not being clear on exactly what you are trying to accomplish. It's certainly unusual in the JSP environment and personally I can't make heads or tails out of what you are really trying to accomplish.
Perhaps a higher level description of your objectives might help.
hth,
bear
 
Erick Jones
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that a new session is being created when you open the URL connection. This is essentially a redirect. I think what you really want is to forward using the RequestDispatcher.
Why are you using the session instead of the request? It is a better practice to pass the parameters to the JSP using the request, rather than using the session to hold global information.
 
Ven Mahi
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your replies
I have an application where i will store all my values in a object and use that object to calc and create Html Pages.
I am saving that object in session and that will be used in other JSPS to calc and create Html Pages.
I am saving cases to a database and to batch print all these cases i have to create the Object from Data , store it in session and it will be used by other jsps to create html pages and save them to a file or directly print them some how
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic