469,300 Members | 2,293 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,300 developers. It's quick & easy.

how to load different content with the same page

kaleeswaran
132 100+
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
7 6490
r035198x
13,262 8TB
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
132 100+
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
r035198x
13,262 8TB
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
132 100+
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
r035198x
13,262 8TB
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
132 100+
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
r035198x
13,262 8TB
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.

Similar topics

3 posts views Thread by Bosch News | last post: by
1 post views Thread by Chriss | last post: by
6 posts views Thread by acord | last post: by
1 post views Thread by ckarbass | last post: by
6 posts views Thread by ipy2006 | last post: by
3 posts views Thread by Kojikabutosv | last post: by
3 posts views Thread by Queez | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.