Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!

chiu pong

Greenhorn
+ Follow
since Aug 11, 2003
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 chiu pong

you should have a 'classes' folder inside the WEB-INF and keep the beans in.
But you should notice that is there any package inside your bean.
eg. if your bean file have the following code at the top:

Then you should have a 'support' folder inside the 'classes' folder.
Hope this help.
ypc
14 years ago
JSP
hi,
it's me again . I have a problem on detecting the checkboxes.
In a.jsp, i have the following code in a form.
<%
for (int j=0; j<size; j++) {
if(isLinked){
%>
<input type="checkbox" name="table<%=j%>" value="<%=tablename%>" checked/>
<%}else{%>
<input type="checkbox" name="table<%=j%>" value="<%=tablename%>" />
<%
}
}
%>
In a_action.jsp, which is the action page of the form, I detect the check boxes as followings:
<%
for (int i=0; i<size; i++) {
String tn = request.getParameter("table" + i);
if (tn!=null) {
//do something
}
}
%>
The problem is in a.jsp, checkboxes will be checked by default if isLinked==true, so i cannot detect they are checked or not by the action in a_action.jsp. String tn will always be null no matter i uncheck or check the default checked ones.
Can anyone suggest me how to handle this matter?
thx a lot.
ypc
14 years ago
JSP
hi,
I have a question about the problem caused by pressing the 'BACK' button on the broswer.
Suppose i have 3 pages, namely a.jsp, b.jsp and c.jsp.
a.jsp contains a form for user to enter some information and its action page is b.jsp.
b.jsp will collect the information from a.jsp and insert it to the database and then redirect to c.jsp.
c.jsp is just a notice page. However if the user press the 'BACK' button on c.jsp, it will cause the b.jsp to insert the data again.
So how can i handle this situation? Is it an usual way to set a session in a.jsp and invalidate it at the end of b.jsp?
thx for reply.
cheers,
ypc
14 years ago
JSP
hi,
I want to ask a question about redirecting. I have a link in the test1.jsp to download a file. After I download the file, I want to redirect the user to a page to notify the user. How can I do that?
Below are the original codes i have now:
Test1.jsp

FileDownload.jsp

I have tried to add response.sendRedirect("XXX.jsp"); after out.close(); but it doesn't work.
Thanks for suggestions.
cheers,
ypc
[ August 28, 2003: Message edited by: chiu pong ]
14 years ago
JSP
hi,
I have a question on generating a new html page. Suppose I fill in a form which has 3 fields (name, age, address) in form.jsp. The action page of the form is form_action.jsp.
I want to generate a new page, say new.html, by using the form_action.jsp.
Does the HTMLWriter class is suitable for my situation and where i can find a tutorial about this class?
Thx for suggestions.
14 years ago
JSP
hi,
I have question on generating a new jsp page. Suppose I fill in a form which has 3 fields (name, age, address) in form.jsp. The action page of the form is form_action.jsp.
I want to generate a new page, say new.jsp, by using the form_action.jsp.
I know the File object can create the new file (new.jsp), but how can I write the form data into this new page?
Thx for suggestions.
cheers,
ypc
14 years ago
JSP
hi,
I have one question. I retrieve the text into the textarea by:
<% String text = rs.getString("Description").trim(); %>
<textarea rows="4" cols="40" name="Description">
<%= text %>
</textarea>
However, the text is appeared in the middle of the textarea, not the beginning. How can i format the text in the textarea after retrieved from database?
Thx,
ypc
14 years ago
JSP
hi,
I am quite new to jsp and I want to ask for advice.
I have a form as below in multiUpload.html for users to upload files:
<form action="multi_action.jsp" enctype="MULTIPART/FORM-DATA" method="post">
Select file1 to upload <input type="file" name="filename1"><br>
Select file2 to upload <input type="file" name="filename2"><br>
Select file3 to upload <input type="file" name="filename3"><br>
Select file4 to upload <input type="file" name="filename4"><br>
Select file5 to upload <input type="file" name="filename5"><br>
<input type="submit" value="Upload"><br>
</form>
In the page multi_action.jsp, i use the following code but cannot check how many files the user have uploaded, no is null when print out.
<%
String files;
int fileCnt = 1;
int no = 0;
While (fileCnt < 6) {
files = request.getParameter("filename" + fileCnt);
if (files!=null) {
no++;
}
fileCnt++;
}
out.println("no: " + no);
%>
Is there any way to do check how many files the user have uploaded?
thx for advice.
ypc
14 years ago
JSP
hi,
i want to ask a question about session.
when i use session.setAttribute() in page1.jsp on one broswer window, is it still valid on page2.jsp on different broswer window until the broswer window of page1.jsp is closed?
if so, does it mean i can use the session on any pages on any broswer window provided that the broswer window of page1.jsp is not closed?
thx for answering.
ypc
14 years ago
JSP
hi,
I want to get some suggestions on using session or hidden form to transfer variables through jsp pages.
There are two variables (loginName & loginGp) in my application that need to be transfered through pages.
I am now using session.setAttribute() and session.getAttribute() to store and retrieve the variables. I think it is quite convenient to use session. But I heard that using hidden form to transfer variables is a better way.
Can anyone tell me the pros and cons by using session and hidden form? Which one is more suitable for my case?
thx a lot.
ypc
14 years ago
JSP
hi,
i have a question on frames and variables transfer. i have a page (mainFrame.jsp) with two frames (frameA.jsp and frameB.jsp). i get a variable (LoginName) in mainFrame.jsp and transfers it to frameA.jsp. In frameA.jsp, i get the variable and use it to retrive another varibale (pathname) and then transfer it to frameB.jsp. Can anyone suggest me a method to do so?
Thanks!!
PS. Is it a good way to pass the variables by using hidden form?
ypc
14 years ago
JSP