• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to load a page properly ?

 
suki sahu
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

In my web app, I have a page getPatientDetails.jsp.
In this page i am getting patient information and editing is also allowed in this page.
Now suppose i am have edited a Patient named X something lets say height=100.
Now when i try to edit another patient there also i am getting the height value as 100.
Now suppose if i make edit the getPatientDetails.jsp(like writing anything lets say hi) then i am getting proper information.
I do not know how to solve it.

thought there is some cache problem so i use to call getPatientDetials.jsp?+new Random().nextLong())
But the problem is still the same
 
Prajakta Acharya
Ranch Hand
Posts: 138
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is your JSP included in any JSP with a static include?
Are patient attributes set in session?
Have you tried following code in your JSP?

 
suki sahu
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i include another jsp in this jsp?
What do you mean by static jsp?
yes i use session attributes
 
Prajakta Acharya
Ranch Hand
Posts: 138
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Static include means JSP code is included to the parent JSP at compile time.
So, if you are making any changes to the child JSP, the parent JSP needs to be recompiled for it to reflect changes.

Can you post your JSP code here?
 
suki sahu
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sure i am posting the code here but it is some 2000 lines,so i am explaining the flow.
Editpatient.jsp includes patientlist.jsp


patientlist.jsp has two forms getpatientlist.jsp and viewpatientlist.jsp

if you want any screenshots then i am ready to post it

editpatient.jsp ias follows


patientlist.jsp




getpatientlist.jsp


 
suki sahu
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please ask me if you need any more information
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please ask me if you need any more information

What you posted is already way, way too much. I can't imagine anyone wanting to try and make sense of 3000 lines of code. There may be a passing chance if you delete the 90% of it that are not relevant, but even then it's a lot to ask of people. You may want to become familiar with the concept of an SSCCE (that's a link).
 
suki sahu
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please tell me how to know the which version http is my app running.
i know it is 1.1 by using get request
Inside the body i write these line

<body>
<!---->
<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1

response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
<!-- -->
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand how the HTTP version would be relevant. But let's stick to one topic per thread. If you have unrelated questions, start a new topic.

Also, you need to fix your display name. See http://www.javaranch.com/name.jsp for what an acceptable display name is around here. You should do this prior to your next post.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From a cursory look at the code, it seems that it is wide open to SQL injection attacks. And it seems to deal with medical data, where security is paramount. With all due respect, but if that is correct, then it is unacceptably bad practice (not to mention the bad design of a 2000 line JSP, or of mixing Java code in JSPs). Please get someone more experienced involved before you put a system in place that is not secure.
 
suki sahu
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do you mean to say to use MVC pattern?
 
suki sahu
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
see i have a link editpatient which calls editpatient.jsp
editpatient.jsp includes patientlist.jsp.
I am using ajax call for searching (like acording to lastname,firstname,city)
this is the way i am calling getpatientlist.jsp
<td>
<form action="getPatientDetails.jsp?<%=new Random().nextLong() %>"><input type="hidden" name="hidden" value="<%=count%>"/><input type="submit" value="edit" style="color: #fff;background:#4d90fe" ></form>
</td>
in all the pages
i am using this

<!---->
<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1

response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
<!-- -->
<!---->
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using MVC is just one of the improvements I would advise; that means no Java code in the JSP.

Preventing SQL injection (along with XSS and all the other typical web app vulnerabilities) is another.
 
suki sahu
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any Solutions for my problem?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:I can't imagine anyone wanting to try and make sense of 3000 lines of code. There may be a passing chance if you delete the 90% of it that are not relevant, but even then it's a lot to ask of people. You may want to become familiar with the concept of an SSCCE (that's a link).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!