By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,066 Members | 739 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,066 IT Pros & Developers. It's quick & easy.

how to load different content with the same page

kaleeswaran
100+
P: 132
Hi!
i am trying to display different content with the same page.how to do that?...
my idea is the page is static but the content will be displayed on the page dynamically change when the user click the submit button...
give me some idea.....
thank you,
kaleeswaran
Nov 13 '07 #1
Share this Question
Share on Google+
7 Replies

10K+
P: 13,262
Hi!
i am trying to display different content with the same page.how to do that?...
my idea is the page is static but the content will be displayed on the page dynamically change when the user click the submit button...
give me some idea.....
thank you,
kaleeswaran
I suppose these are web pages you are talking about?
If you are using JSPs then this can stay in this forum, otherwise it does not belong in the Java forum. What content do you want to change on the page and where is this "dynamic" content coming from.
Nov 13 '07 #2

kaleeswaran
100+
P: 132
Thank you for your reply....
ya for example suppose the user enter the user name password and then the page should not move to another screen.now i am trying in struts..
i did some sample code...the code look like this...
this is JSP PAGE::
<%@ page import="TestApp.TestJava" %>
<%
TestJava T= new TestJava(response);
T.CreateHeader(response);
String Screen = (String)request.getParameter("SCREENCODE");
System.out.println("Screen1 "+Screen);
if (Screen==null)
Screen="";
if (Screen=="")
{
T.NoScreenCode(response);
out.println("Screen:"+Screen);
}
else if (Screen.equals("FIRST"))
{
System.out.println("Screen2 "+Screen);
T.FirstScreenCode(response,request);
out.println("Screen");
}
T.EndHeader(response);
%>
In Servlet File:

public TestJava(HttpServletResponse response) throws ServletException, IOException
{
out =response.getWriter();
System.out.print("123");

}
public void NoScreenCode(HttpServletResponse response)
throws ServletException, IOException {
System.out.print("------------------------");
out.write("<form method=Post target=index.jsp>") ;
out.write("<Input Type=Text Name=Text>");
out.write("<Input Type=Text Name=Pass>");
out.write("<Input Type=hidden Name=SCREENCODE value=FIRST >");
out.write("<Input Type=Submit Value=submit Name=btn >");
out.write("</form>");

}

public void FirstScreenCode(HttpServletResponse response,HttpServletRequest request)
throws ServletException, IOException
{
System.out.println("***************** "+request.getParameter("SCREENCODE"));
System.out.println("FIRST");

//out.write("<form method=Post target=index.jsp>") ;
out.write("USer Name ");
//out.write("<H1>"+request.getParameter("Text")+"</h1>" );
//out.write("<Input Type=Text Name=Pass>");
//out.write("<Input Type=hidden Name=SCREENCODE value=SECOND >");
//out.write("<Input Type=Submit Value=submit Name=btn >");
//out.write("</form>");

}
public void CreateHeader(HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out =response.getWriter();
out.write("<html> <head> <title>KALEES PAGE</title> </head> <body>");
out.write("<form method=Post target=index.jsp>") ;
}

i don't know..is this is useful for reference.....
Nov 13 '07 #3

10K+
P: 13,262
Thank you for your reply....
ya for example suppose the user enter the user name password and then the page should not move to another screen.now i am trying in struts..
i did some sample code...the code look like this...
this is JSP PAGE::
<%@ page import="TestApp.TestJava" %>
<%
TestJava T= new TestJava(response);
T.CreateHeader(response);
String Screen = (String)request.getParameter("SCREENCODE");
System.out.println("Screen1 "+Screen);
if (Screen==null)
Screen="";
if (Screen=="")
{
T.NoScreenCode(response);
out.println("Screen:"+Screen);
}
else if (Screen.equals("FIRST"))
{
System.out.println("Screen2 "+Screen);
T.FirstScreenCode(response,request);
out.println("Screen");
}
T.EndHeader(response);
%>
In Servlet File:

public TestJava(HttpServletResponse response) throws ServletException, IOException
{
out =response.getWriter();
System.out.print("123");

}
public void NoScreenCode(HttpServletResponse response)
throws ServletException, IOException {
System.out.print("------------------------");
out.write("<form method=Post target=index.jsp>") ;
out.write("<Input Type=Text Name=Text>");
out.write("<Input Type=Text Name=Pass>");
out.write("<Input Type=hidden Name=SCREENCODE value=FIRST >");
out.write("<Input Type=Submit Value=submit Name=btn >");
out.write("</form>");

}

public void FirstScreenCode(HttpServletResponse response,HttpServletRequest request)
throws ServletException, IOException
{
System.out.println("***************** "+request.getParameter("SCREENCODE"));
System.out.println("FIRST");

//out.write("<form method=Post target=index.jsp>") ;
out.write("USer Name ");
//out.write("<H1>"+request.getParameter("Text")+"</h1>" );
//out.write("<Input Type=Text Name=Pass>");
//out.write("<Input Type=hidden Name=SCREENCODE value=SECOND >");
//out.write("<Input Type=Submit Value=submit Name=btn >");
//out.write("</form>");

}
public void CreateHeader(HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out =response.getWriter();
out.write("<html> <head> <title>KALEES PAGE</title> </head> <body>");
out.write("<form method=Post target=index.jsp>") ;
}

i don't know..is this is useful for reference.....
So what do you want to happen when the user has entered the username and password?
Nov 13 '07 #4

kaleeswaran
100+
P: 132
i like to display after the user enter the details and the next further information like a user informations on the same page...i want that the jsp page is remains constant but the content should change as user needs...
Nov 13 '07 #5

10K+
P: 13,262
i like to display after the user enter the details and the next further information like a user informations on the same page...i want that the jsp page is remains constant but the content should change as user needs...
That is not how such systems are usually designed.
Don't try to display everything on one page. It makes the whole thing cumbersome and impossible to maintain. A log in screen should not try to do more than providing functionality for a user to log in.
Nov 13 '07 #6

kaleeswaran
100+
P: 132
okay thank you,
but i have more jsp page's.i am passing the value throw URL so i should minimize access time right?..i heard that we are passing the value through url accessing time will increase..that's why i am tried that....\
can u give some alternative solution?....
Nov 13 '07 #7

10K+
P: 13,262
okay thank you,
but i have more jsp page's.i am passing the value throw URL so i should minimize access time right?..i heard that we are passing the value through url accessing time will increase..that's why i am tried that....\
can u give some alternative solution?....

Put the values on a form and submit the form instead.
Nov 13 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.