ziqiang wu

Greenhorn
+ Follow
since Jun 18, 2001
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 ziqiang wu

Thank you for your advice!
18 years ago
Hi all:
I am a 1.8 yrs "real work" experienced java developer with H1B. During this 1.8 yrs period, through my three cool web based projects, I really enhanced my skills on Java servlet, JDBC, EJB, JSP, java bean, XML, HTML, SQL and javascript. as a person with such a set of skills and the experience, I want to find another job as Java developer(my company is very weak now). Please kindly give me some advice that would be helpful for my next job seeking.
Your advice will be most appreciated!
Wu
life is hard for H1B...
18 years ago
Hi I am an experienced Jsp and Java player. C is a piece of cake for me, but C++ make me uncomfortable. My high points are Java servlet, JDBC, EJB, JSP, C, XML, HTML, and Javascript. My favorite games are web based 99.9% dynamic Java and JSP projects.
It is better if you need Java/JSP/C developer other than C/C++ developer, but I still try to know are my skills attractive to your company? if so, please let me know.
ziqiangw@yahoo.com
Thanks!
18 years ago
Hi Java experts:
please give me a conclusion: Why we need java interface?
Thanks!
Wu
18 years ago
hi ZKr:
base on your new requirement, I believe there are several way to solve this problem. but I think a good solution should hide any logic problems and always make clents not realize their wrong operation, but always get correct results.
I dont like make any unexpected things happened to clients, for example, if client click back button or something else, then they are kicked out of "current status", and forced to be in a unexpected "status".
one way I think should meet your new requirements not by javascript.
in the second page, assumed that you get information(String) by these method.

//initiate, get value and count how many value you got
int count=0;
String ss1=request.getParameter("information1");
count++;
String ss2=request.getParameter("information2");
count++;
.
.
.
Vector forSave=new Vector(), savedInfo=new Vector();
//save all coming information in vector forSave every time
for(int i=1; i<=count; i++)
forSave.addElement("ss"+i);
//if this is first time, no old value to compare, but need to save these value for comparation next time

if(session.getAttribute("savedInfo")==null && request.getParameter("submit")!=null)
{
save ss1, ss2, ss3....;
session.setAttribute("savedInfo", forSave);
}
//if this is not first time, you need get old saved value to compare with current value. only those value that never be saved before can be saved this time
if(session.getAttribute("savedInfo")!=null && request.getParameter("submit")!=null)
{
savedInfo=(Vector)session.getAttribute("savedInfo");
for(int i=0; i<forSave.size(); i++)
for(int j=0; j<savedInfo.size(); j++)
if((String)forSave.get(i).equals((String)savedInfo.get(j)))
{
forSave.removeElement((String)forSave.get(i));
break;
}
else
if((j+1)==savedInfo.size())
savedInfo.addElement((String)forSave.get(i));
//right now, every string in vector forSave never saved before

if(forSave.size>0)
{
retrive information form vector forSave and save them to database or what ever;
}
//save vector savedInfo in session for comparation next time
session.setAttribute("savedInfo", savedInfo);
}
this code is just showing an algorithm to compare coming infomation with old saved infomation. only those information never saved before can be saved only this time.
hope it is helpful for u
Ziqiang Wu
Java Developer
Wellogix, Inc.
hi ZKr:
base on your new requirement, I believe there are several way to solve this problem. but I think a good solution should hide any logic problems and always make clents not realize their wrong operation, but always get correct results.
I dont like make any unexpected things happened to clients, for example, if client click back button or something else, then they are kicked out of "current status", and forced to be in a unexpected "status".
one way I think should meet your new requirements not by javascript.
in the second page, assumed that you get information(String) by these method.

//initiate, get value and count how many value you got
int count=0;
String ss1=request.getParameter("information1");
count++;
String ss2=request.getParameter("information2");
count++;
.
.
.
Vector forSave=new Vector(), savedInfo=new Vector();
//save all coming information in vector forSave every time
for(int i=1; i<=count; i++)
forSave.addElement("ss"+i);
//if this is first time, no old value to compare, but need to save these value for comparation next time

if(session.getAttribute("savedInfo")==null && request.getParameter("submit")!=null)
{
save ss1, ss2, ss3....;
session.setAttribute("savedInfo", forSave);
}
//if this is not first time, you need get old saved value to compare with current value. only those value that never be saved before can be saved this time
if(session.getAttribute("savedInfo")!=null && request.getParameter("submit")!=null)
{
savedInfo=(Vector)session.getAttribute("savedInfo");
for(int i=0; i<forSave.size(); i++)
for(int j=0; j<savedInfo.size(); j++)
if((String)forSave.get(i).equals((String)savedInfo.get(j)))
{
forSave.removeElement((String)forSave.get(i));
break;
}
else
if((j+1)==savedInfo.size())
savedInfo.addElement((String)forSave.get(i));
//right now, every string in vector forSave never saved before

if(forSave.size>0)
{
retrive information form vector forSave and save them to database or what ever;
}
//save vector savedInfo in session for comparation next time
session.setAttribute("savedInfo", savedInfo);
}
this code is just showing an algorithm to compare coming infomation with old saved infomation. only those information never saved before can be saved only this time.
hope it is helpful for u
Ziqiang Wu
Java Developer
Wellogix, Inc.
18 years ago
JSP
hi Zkr:
in the second page, you can set a value in session to guarante information to be saved only one time.
if(session.getAttribute("alreadySubmit1")==null && request.getParameter("submit1")!=null)
{
session.setAttribute("alreadySubmit1", "yes");
save information;
}
hope it work.
ziqiang wu
Java developer
Wellogix, Inc.
18 years ago
JSP
Thank you Peter! you are real professional.
18 years ago
JSP
Hi Peter:
Could you please tell me
1)what difference between req.getRequestDispatcher("address") and res.sendRedirect("address")?
2)How to set html head to protect the page from catched?
Thank you Peter!
Wu
18 years ago
JSP
<%@ page language ="java" %>
<html>
<head>
</head>
<body>
<%!
String ajazz = "";
String apop = "";
String arock = "";
//String submit != null;
%>
<%
if(session.getValue("first_time")==null)
{
ajazz ="**";
apop = "**";
arock = "**";
session.setAttribute("first_time", "**");
}
else
{
ajazz = request.getParameter("jazz");
apop = request.getParameter("pop");
arock = request.getParameter("rock");
}
//String submit = (request.getParameter("submit") != null ? request.getParameter("submit") : "");
%>
<body>
<form method="get" action="check.jsp">
<input type="checkbox" name="jazz" value="jazz"<%=(ajazz ==null)?"Checked" : ""%>>Jazz<br>
<input type="checkbox" name="pop" value="pop"<%=(apop ==null)?"Checked" :""%>>POP<br>
<input type="checkbox" name="rock" value="rock"<%=(arock ==null)?"Checked" :""%>>ROCK<br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
hope it work.
18 years ago
JSP
hi Peter please tell me where the syntax is wrong? just provide an example. Thanks
Wu
18 years ago
JSP
I strong agree with Jon.
18 years ago
Moreover, I think a link, for example <a href="doc.jsp?client=aa&operate=bb>***</a>, can not pass your parameters, you have to use a form to pass them, for example, <form action="doc.jsp?client=aa&operate=bb" method="post" name="f1">.
if I am wrong, please let me know. thanks.
18 years ago
JSP
1. session.setAttribute( "client" , request.getParameter("cly"));
should be
session.setAttribute( "client" , request.getParameter("client"));
2. session.setAttribute( "operate" , request.getParameter("oper")); should be
session.setAttribute( "operate" , request.getParameter("operate"));
according to wn/doc.jsp?client=10&operate=20
Moreover, I used to get value from session by session.getValue("key_name"), not by session.getAttribute("key_name").
18 years ago
JSP