Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

salvador rcn

Ranch Hand
+ Follow
since Feb 18, 2004
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 salvador rcn

>it makes sens to create this in a set of shared classes so they can be invoked from either.

set of shared classes ?
17 years ago
is it possible applet and application both can retain in a single code ?
in fact when i need applet i will use applet and when i need application i will use application . can they stay both in a sigle code ?

how do i invoke them if both of them exists ?

thankig you
17 years ago
i want to use preloader in JSP page.
i have 6 threads. when the 6 threads are done my preloader will vanish and result will be shown.

how do i interact with the preloader from the java code ?
17 years ago
JSP
hi...i have not usued tomcat5 before for web application. but i use sunOne6.1.

suppose i am using a javabean in my jsp page . how does tomcat know the full path ?


example
-------
say,

<jsp:useBean id="test" class="my.Package.Test" scope="session" />


i have Test.class in folder \Root\WEB_INF\classes\my\Package

but server should know the full path to run it.

had it been SUnONE i usued like uri=C:\tomcat\webapps in server.xml. // i.e path before it

and also a server classpath for imported third party classes (like electric xml,Struts tlds, jdbc driver etc etc)


i think these are needed for any web application.

but where do i mention those things in tomcat ? does tomcat require these stuffs ?

otherwise how tomcat will find that package at runtime?


plz give an example where i use this same thing in tomcat...

sunOne's server.xml and tomcat's server.xml looks different...so i am getting difficulty to set the path.

how can i do the equivalent stuff?



QUESTION is :


i want to use a javabean in my jsp page. so what path setting i need and where to put those cofigauration? is it needed at all for tomcat ?



thanks
17 years ago
JSP
look i have made a WEB-INF by my own...it is not the default one.

and i have a customized directory in that WEB-INF as shown above.


so what exactly should i write ?
17 years ago
JSP
is there any answer ?
17 years ago
JSP
i have a jsp page Test.jsp





This file i have saved in the c:/sun/SunWebserver6.1/docs/project/Test.jsp folder.


now i want to import a class(this class is already compiled and is in the c:/sun/SunWebserver6.1/docs/project/WEB-INF/classes folder ) into my Test.jsp file .

i am confused what should i write in my page import statement in the JSP page .

should i write




Q1. plz look at my dir structure of files and tell me whether my importing statement is correct ?


Q2. At the time of creating the class should i write (is it necessary ?) at the top " package project.WEB-INF.classes; " ? otherwise i can write the simple java file and then compile and then put the class file into the classes folder . which one is correct ?


plz can anybody help ?
17 years ago
JSP
is there any soln ?
17 years ago
getparameter() works for single form...but here two forms r there.so i am in trouble.
17 years ago
<html>

<head>
<title>New Page 1</title>
</head>

<body>

<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.txt"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p>                                                                     
<input type="text" name="T1" size="20"><input type="submit" value="Submit" name="B1"></p>
</form>



<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.txt"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p>                                                                     
<input type="text" name="T2" size="20"><input type="submit" value="Submit" name="B1"></p>
</form>

</body>

</html>


here i have 2 forms. T1, T2 two form fields in two form . how do i access T1,T2 in servlet ?
17 years ago
thank you for the response.

ok i am using arraylist. i am stoing data in the arralist.

here are pseudocode.

String data1 = req.getParameter("some_data");
String data2 = req.getParameter("some_another_data");

arrayListObject.add(data1);
arrayListObject.add(data2);


for(int k=0;k<arrayListObject.size();k++) out.println( (String)arrayListObject.get(k) ));



But problem is as soon as I AM USING BACK BUTTON OF the IE and going back to add more elemnts through my .html page . it is not adding to the arrayList and not diaplaying all the things. Only the last two things are displyed.


i want user would add some data . then it would be displayed . if he goes back and add some more data then all those will also be displayed . there would be option ADD/CANCEAL to the database for all these data entered.


But ArrayList is forgetting those old values as soon as i am going back to add some more data in .html page.

can you tell how do i solve the above problem.
17 years ago
hi...i am going to make a servlet. the servlet will get parameter from a html page. say the user is entering shopping1,shopping2 in 2 text boxes and then pressed submit button.

now the servlet should show the list entered by the user and then ask for a confirmation whether he want to confirm "add to database " or canceal.

i am in problem to do the last part. how do i write code to confirm the things user have chosen ?



after pressing submit i would like to get an page which will show all the shopping user have chosen and then ask for a confirmation.



do i need to use Httpsession ? what feature of servlet will be useful for this kind of problem ?
17 years ago
package com.javaranch; // it is declaring only ?

import java.io.*; // it is calling only ?

wwhat is the difference ?
17 years ago
package com.javaranch; // does it making a package or calling a package ? but calling needs // import.

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class PostServlet extends HttpServlet
{
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>\n <body>\n");
out.println(" <h2>\n Hello World\n </h2>\n");
out.println(" </body>\n</html>\n");
out.flush();
out.close();
}
}
17 years ago


output : i am getting a window at the left corner of the screen and a print "hello" in the middle of the window.

question:
1. how can i move the window to my desired position , say at the middle of the screen.

2. why only the print "hello" . where the button has gone ? a button has border . but i dont see border here ....only the print "hello" at the middle of the window !! . so how can i get borders around the button so that it looks really a button.
thanx
18 years ago