javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Use : java.text.SimpleDateFormat

Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("EEEE, MMMM dd, yyyy");
String s = sdf.format(now);
System.out.println(s);

Try to experiment by changing the number of 'E's and 'M'
Check this example:

Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("EEE, MMM dd, yyyy");
String s = sdf.format(now);
System.out.println(s);

Check the API for additional format options. Try to experiment a bit with the Date and Time Patterns

You can do the oppositte with the parse method:

String s = "11-19-2011";
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy");

Date d = sdf.parse(s);

System.out.println(d);
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

The encryption takes place in the servlet not when you submit the page. You pass the password the user entered from the gui, so the password at the url is unencrypted. It goes to the servlet where you do the encryption.

There is no way to avoid that. (Actually there is but it is needless).
What people do is use:

<form name="form1" method="POST" action="LoginServlet" onsubmit="return checkForm()">

method="POST"

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Embedded Google translator should solve it. What you think javaAddict?

It looks interesting. Maybe not like how the OP would have imagined, but if it does the trick, it's up to the poster's choice.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

yes, I want the user to enter a word or text and the page will translate it? Interface done but function not yet...can u help me??

I don't know or don't believe that java core has such methods or classes. You may want to search the net for some other libraries

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Are you talking about localization where you can change the labels of your page to the language of your choice, or you want the user to enter a word and the page will translate it?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

The pop method of the Stack class is not complete. Maybe you have fixed it already, but you need to check if the stack is empty before removing the top element.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You shoulde uase the: if (toss % 30 == 0)

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Have the System.out.println("Number of tosses\t\tNumber of Heads\\ % \t\tNumber of Tails\\ %"); before the loop.

Loop 500 hundred times. Every 30 times, print the System.out.printf("\t%d\t\t\t\t%d %d\t\t\t\t%d %d", frequencyHeads + frequencyTails,frequencyHeads,percentageH, frequencyTails,percentageT); in the loop

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

When you divide an int with an int you get an int:
12/100 = 0
12.0/100.0 = 0.12

double percentageH = (1.0*frequencyHeads/totalTosses);
double percentageT = (1.0*frequencyTails/totalTosses);

You multiply by 1.0 which is a double, so
1.0*frequencyHeads is also now double and
1.0*frequencyHeads/totalTosses is also now double

And you store into a double.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

First of all in the CheckObject method you do this:

for(int i=0;i<object.length;i++){
     if (object[i]!=null&&object[i].equals(object[i+1]))

i+1 When you reach the last element of the array, meaning that i would be: object.length-1 you will call the object . But then you will also call the object[i+1] which will give you an exception because i+1 exceeds the arrays length.
Assuming that length is 4: 0,1,2,3 when i=3 you call: object[3].equals(object[4]) But object[4] is wrong because the length of the array is 4.
I would advice this:

for(int i=0;i<object.length-1;i++){
     if (object[i]!=null&&object[i].equals(object[i+1]))

So in my previous example, when i=2 you will do: object[2].equals(object[3]) Then when you reach i=3 (i<object.length-1)=(3<3) you will not enter the loop because you have reached the last element and there is no next to compare it with.

Also you need to remove the check variable from the TestEntity class. It doesn't do anything. You declare it false and then you print it. It is NOT the same with the one declared locally in the CheckObject method.

And the reason why the CheckObject doesn't return true is because the method equals returns false: (object.equals(object[i+1]))

film[1]=new Entity("C305","Fu Lu Shou","jack",2,1500,"CC Sdn. Bhd.",2);
film[2]=new Entity("C305","Fu Lu Shou","jack",2,1500,"CC Sdn. Bhd.",2);

Those objects are different, they are not the same. The equals returns false at those. All classes are subclasses of the class java.lang.Object. That class has a equals(Object) method. You haven't declared such method in the Entity class so it will call the method from the Object class:

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You don't call the actionperformed. It is automatically called whenever you click a button.
You implement it normally in the same way you do when you use javax.swing. Your applet should implement the ActionListener interface, then you will declare the actionPerformed method and write code inside it. Then you will add to your buttons that ActionListener (namely the applet like you do with normal java GUI).

If you want to call the actionPerformed method explicitely meaning you want to call the code inside in some cases, I would suggest to either call directly the code you put inside the actionPerformed method, or trigger the button clicked yourself. The JButton class has a doClick method for that purpose

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

When you open a brace or a parenthesis close it immediately! Then write code inside it:
Also you don't declare methods inside other methods. main is a method: public static void main(String args[]) And you did this:

public static void main(String args[]) {


public double getMPG()
   	{
   	MPG = 0;
   	return MPG;
   	}

}

Each method must have its own body. Then you can call methods inside other methods:

import java.util.Scanner;

public class Odometer
{

	public static void main(String args[])
	{
   
   	Odometer first = new Odometer();
   	Scanner keyboard = new Scanner(System.in);
   
   	System.out.println("How many miles did you drive?");
   	double Miles = keyboard.nextDouble();
   	first.getMiles();
  
   	System.out.println("What is the MPG?");
   	double MPG = keyboard.nextDouble();
   	first.getMPG();
        } 

   	public double getFuel()
   	{
   	Fuel = 0;
   	return Fuel;
   	}

   	public double getMiles()
   	{
   	Miles = 0;
   	return Miles;
   	}

   	public double getMPG()
   	{
   	MPG = 0;
   	return MPG;
   	}
}

Also the methods that you declare do nothing. They simply return 0. The global variables that you declared are not the same with the ones inside the main:

public int Fuel=0;
public static void main(String args[])
{
   int Fuel = 5;
}

Those 2 variables are not the same. Try this and see for yourself:

public int Fuel=10;
public static void main(String args[])
{
   int Fuel = 5;
   Odometer first = new Odometer();
   System.out.println("Local Fuel="+Fuel);
   System.out.println("Global Fuel="+first.Fuel);
}

I would advice somthing like this:

import java.util.Scanner;

public class Odometer
{

   	private double Fuel = 0;
        public double Miles = 0;
        public …
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Do you have any code? The assignment that you posted is actually an explanation of what you need to do:

"Data fields for your instrument should include number of strings, an array of string names representing string names (e.g. E,A,D,G), and boolean fields to determine if the instrument is tuned, and if the instrument is currently playing."

Create a class that has the above fields. Follow the instructions to create your classes and methods. You don't need to think anything.

If you have errors post your code.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Can you post the code that you are having problem. You need to call the class ReadName - instantiate it.
Can you post the code that you call and gives you the error

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

The rollback method throws an SQLException. It needs to be in a try-catch. You will put it where your logic dictates.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

The readLine() method that you use, in which class it belongs to? Because if you use the BuffereReader class, then when that method returns null it means that it has reached the end of the file.
If the file's last line is for example: "aaa"
Then when you call the readLine, for the last line it will return the: "aaa" and if you call it again it will return null.

If you are using Scanner, check the API for the method hasNextLine (I think)

In your case, take the line, and handle it only if it is not empty !line.trim().equals("")

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Submit the page to a servlet or a jsp, take the value of the testbox from the request, call a method with the value as argument, that method should have code that inserts in the database, redirect to whatever page you want, or stay at the same jsp.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Is this:
tomcat/webapps/ROOT/WEB-INF/classes
In the classpath?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Have you looked up, what is a Family Feud game ?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

@javaAddict: Thanks, I tried your code and it's working! I guess the problem is solved then. I don't get why i can't have "while (tallPosisjon <= famousFinalFour.length())" though, but I'll look into it.
Thanks everyone for your help, I'll mark this as solved

@Norm: aha, of course. Well I guess it's solved now anyway.

Because when tallPosisjon = famousFinalFour.length() it will enter the loop and you will call the:
famousFinalFour.charAt(tallPosisjon);

But indexes in java are from 0 to length-1. If a String has length 4 ("abcd") you can call:
charAt(0), charAt(1), charAt(2), charAt(3) but not charAt(4)

It like when you loop:

for (int i=0;i<array.length;i++) {

}

You don't use <=

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

@James: Yes, I saw that too and I tried to put an increment on tallPosisjon between line 51 and 52. But it didn't help, just gave me thios error-message:

"java.lang.StringIndexOutOfBoundsException: String index out of range: 4
at java.lang.String.charAt(Unknown Source)
at Bilregister.kjennetegnErGyldig(Bilregister.java:48)
at Bilregister.beOmOpplysningerForBil(Bilregister.java:76)
at Bilregister.main(Bilregister.java:10)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at edu.rice.cs.drjava.model.compiler.JavacCompiler.runCommand(JavacCompiler.java:271)"

@Norm: I'm a beginner with Java so not quite sure what you mean. I don't have a hasNext() or next() in my code? When it stops, I mean that it should move on to "arsmodell", but it doesn't. Nothing happens

Look at my comment about the use of '<' against the '<='

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

So you are saying that the method kjennetegnErGyldig correctly returns false when you enter wrong data but when you enter the right data the loop doesn't go to the System.out.println("Årsmodell: "); call ?

If yes then maybe the problem is with the kjennetegnErGyldig method. Try to add more prints at the beginning and the end. Specifically before you return true. Have you tested it? Since it is static you can call it alone from a main method and see if it returns true.

My guess is that when it enters the last loop it never exits:

while (tallPosisjon <= famousFinalFour.length()) {
  if (! (famousFinalFour.charAt(tallPosisjon) >= '0' &&      famousFinalFour.charAt(tallPosisjon) <= '9') ) {
  System.out.println("De fire siste sifrene må være heltall mellom 0 og 9.");
  return false;
}
}

Look at it. If it enters the loop you have no way to exit. The tallPosisjon will always be lower than the famousFinalFour.length. Shouldn't you be increasing the tallPosisjon with each loop, so eventually the tallPosisjon <= famousFinalFour.length will become false?

while (tallPosisjon < famousFinalFour.length()) {
  if (! (famousFinalFour.charAt(tallPosisjon) >= '0' &&      famousFinalFour.charAt(tallPosisjon) <= '9') ) {
  System.out.println("De fire siste sifrene må være heltall mellom 0 og 9.");
  return false;
}
tallPosisjon++;
}

Notice the the check should be: tallPosisjon < famousFinalFour.length without the equals. If it is equal the charAt will give you an ArrayIndexOutOfBounds Exception.
The tallPosisjon should be from 0 till famousFinalFour.length-1

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

What do you mean: "when we try to delete it" ?
You have the .class file. That is what is executed

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

By setting it to null.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Have you declared a constructor Car(int) ?

When you get: "cannot find symbol" it is usually because you are using a method or class that doesn't exist.

Meaning that you either haven't imported the class or you are calling the method/constructor with the wrong arguments or return type, or you simply have misspelled the method/constructor.

Or just as the messages says that method/constructor (Car(int)) doesn't exists

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Help for initializing Scanner:

Scanner keyBoard = new Scanner(System.in);

The rest are up to you.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Can you post the jsp code. Also can you print in the jsp the elements of the list?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

If this is the error that you get:
UserBean cannot be resolved to a type
then:
When you use the UserBean in the servlet, does it compile?
If it compiles and the jsp doesn't compile then I think it is because you haven't import it.

If you still can't fix it, post the whole code of the jsp, pointing where is the line that you get the error is

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Dear javaAddict,
Am not ignoring you . You already solved many of my previous threads. i must thankful for you.
Am not the person who ignores seniors suggestion .

Actually i used your second example

RequestDispatcher dispatcher = request.getRequestDispatcher("user.jsp");
dispatcher.forward(request, response);

but it shows null pointer exception.i was frustrated i am keep on trying pls help me

My example said:

request.setAttribute("...",obj);

RequestDispatcher dispatcher = request.getRequestDispatcher("user.jsp");
dispatcher.forward(request, response);

And: ArrayList obj = (ArrayList)request.getAttribute("list"); You wrote at your post: [B]session[/B].setAttribute("list", list);

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Read the stack trace. It tells you exactly the error. It is very basic. For someone who writes jsp shouldn't have a problem in correcting it.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Can you explain the code? Because it is very wrong! So maybe you didn't meant to write that but it is just some sort of pseudo code.
If it is real code then it is has some errors.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Nothing worked for me :(

I have decided to rewrite the code. Thanks anyways!

Use the BufferedWriter class.
It has a method:
newLine()
That adds a new line to the file that you are writing:

FileWriter fw = new FileWriter("file");
BufferedWriter bw = new BufferedWriter(fw);

bw.write("some string");
bw.newLine();

...

bw.close();
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster


actually I need to transfer the list of data from servlet to jsp. i tried lot ut its not working
my servlet code is

dataManager.getConnection();
		list =new ArrayList<UserBean>(dataManager.getBalanceSheet(int_month,int_year));
		session.setAttribute("list", list);
		RequestDispatcher dispatcher = request.getRequestDispatcher("/ViewBalanceSheet.jsp");
		dispatcher.forward( request, response);

i can access these data in servlet itself but i am not able to transfer to my jsp page

my jsp code is

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="java.util.ArrayList"%>
<jsp:useBean id="userBean" class="UserBean" scope="session"></jsp:useBean>
<jsp:useBean id="list"type="ArrayList<UserBean>" scope="session" ></jsp:useBean>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%

UserBean user = new UserBean();
for(int i=0; i < list.size(); i++)
{
	user = (UserBean) list.get(i);
	out.println(user.getRep());
}
%>
</body> 
</html>

But it shows error
pls help me

Thanks in advance

You are completely ignoring my suggestions and especially the second example in my first post. Thank you for making waste my time to give you the solution when you simply ignored me.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I haven't tested it but instead of writing:

pw.print("Hi there, how are you?");
pw.print("\n");
pw.print("I'm fine good sir");
pw.print("\n");

You could try:

pw.println("Hi there, how are you?");
pw.println("I'm fine good sir");

println VS print

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Hello again,

static final String newline = System.getProperty("line.separator");

It does return null. How should I set the property now?
Could you guide me a little bit more about it? Thanks everyone for the quick reponses

The System.getProperty("line.separator") should return what you need. Why do you say it returns null. How did you test it?

If it still doesn't work you can try:

pw.println("Hi there, how are you?");
pw.println("I'm fine good sir");
pw.print("Thank you");

pw.close();

I haven't tested it, but even if it work you should still try to make the line.separator property work

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You can submit to the same page: file1.jsp and do the processing there. Take the data from the request. The first time you go to the page, the request will be empty so you can use that check. When you submit then you request will not by null:

file1.jsp

<form action="file1.jsp" >
  <input type="text" name="data_1" />
</form>

When you submit to the same page:

String data1 = request.getParameter(data_1);

But the first time you go to the page there will not be any data_1 in the request so:

file1.jsp

String data1 = request.getParameter(data_1);

if (data1!=null) {
  // calcuate data
  // get answers
}

<body>
  <%
  if (data1!=null) {
  %>
    //  show answers
  <%
  }
  %>

<form action="file1.jsp" >
  <input type="text" name="data_1" />
</form>
</body>
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Why do you call the updateQuery.next() inside the loop?
You call it at the end of the loop and at the beginning. So you are missing a row each time you loop.
Also you get that exception there because the array name is null.

Delete what you have. Don't use that many arrays. Create a single object with attributes the name, manufacturer, description,... and add get/set methods.
Then have an array of that object.

class Product {
  String name=null;
  ...
  double price=0;

  // constructor
  // get/set methods
}

But in this case you shouldn't use arrays because you don't know the size. You don't know how many elements you will get.
Use ArrayLists:

ArrayList list = new ArrayList();
list.add( /*the instance of your object*/ );

Product prod = (Product)list.get(i);

Put that code in a method that returns that ArrayList and close the ResultSet, PreparedStatement and Connection.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Simple way:
When you change the select box use javascript to submit the form to the same page. When you do that take from the request the value of the select box.
Remember the first time you load the page, there is nothing in the request, so if you try to get the value from the select box it would be null.
When you submit to the same it will not be null.
When it is not null call a method and get the data:

yourPage.jsp

<%
String name = "";
...

String empId = request.getParameter("empId");
if (empId!=null) { // it means you submitted to the page
  // call the method to get the data from the database
  name = "data from database";
}
// if empId is null do nothing since you went to page without submitting
%>

...

<form action="yourPage.jsp" id="yourPageForm" name="yourPageForm" >
  Name: <%= name%>
  ...
</form>

Add an onchange event at the select box and submit the form. The form will submit to the same page:

<%
String name = "";
...

String empId = request.getParameter("empId");
if (empId!=null) { // it means you submitted to the page
  // call the method to get the data from the jsp
  name = "data from database";
}
// if empId is null do nothing since you went to page without submitting
%>

...

<form action="yourPage.jsp" id="yourPageForm" name="yourPageForm" >
  Name: <%= name%>
  ...

  <select id="empId" name="empId" onchange="document.getElementById('yourPageForm').submit();">
    ....
  </select>

</form>

I would advice you to …

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Read the error message. It tells you exactly where the error is:

org.apache.jasper.JasperException: Exception in JSP: /index.jsp:15

File: index.jsp, line: 15

Also:

java.lang.NullPointerException
org.apache.struts.taglib.TagUtils.pageURL(TagUtils.java:1056)
org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:448)
org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:311)
org.apache.struts.taglib.html.LinkTag.calculateURL(LinkTag.java:463)
org.apache.struts.taglib.html.LinkTag.doStartTag(LinkTag.java:341)
org.apache.jsp.index_jsp._jspx_meth_html_005flink_005f0(index_jsp.java:95)
org.apache.jsp.index_jsp._jspService(index_jsp.java:67)

At that line you probably try to use something which is null

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Do you have this: "com.ibm.db2.jcc.DB2Driver" in the classpath ? Or the jar that contains it?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You need to post the whole stack trace. If you read it carefully you will find that it tells you which of your files has the error.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

hello,i m final year it student,i want a mini project on VB.Net so please help me.................

Does this look like a VB.Net forum?
You might want to try posting to the right forum and an administrator should close this thread.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

hi javaAddict,
Thanks
But here i need to transfer array list to jsp how can I do that..

So put into the request (request.setAttribute) like my second example

I already told you. ArrayList is an object like any other. Use the second example with the get/set Attribute and put in the the request the ArrayList instance.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You wrote:

ArrayList GetLoggedInUser = dao....
BorrowerRecordViews LoggedInUser = (BorrowerRecordViews)GetLoggedInUser;

GetLoggedInUser is a list. Why do you cast it to BorrowerRecordViews ?
Also you wrote the code for the GetLoggedInUser method, right? Then I don't see what is the problem. You should know how to call it and what to do with the results, since you wrote the implementation: You put BorrowerRecordViews objects in the list that you return That is the solution to your problem

If you are having problems then I would suggest going back to your notes and study how to call methods, and how to use generics and lists.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Then pass as parameter the integer that it needs. I don't know your code to tell you what to pass and how. I told you the methodology.
Call the method that returns the data that you need and display them.
Now you have to think and make the neccassary changes.

Also: I assume that when you get the username from the session you had put it there when you logged in. It doesn't automicaly gets there

If the method takes as argument an int then put in the session the int that you need and take that when you call the method. If you don't have access to that int change the method to take as parameter the username instead of the int.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

list is an objct. So put into the request (request.setAttribute) like my second example

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You mean that this:

<% 
String link = "";
String user = (String)session.getAttribute("user"); 
if (user!=null) {
  link = user + ".jsp";
} else {
  // do something else since the user is not in the session
}
%>

<a href = "<%=link%>" > some text </a>

Is not what you want?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
responce .sendRedirect("user.jsp");

For single values that approach could work. You can use this:

String value1 = "aaaa";
String value2 = "bbbbb";

responce.sendRedirect("user.jsp?param1="+value1+"&param2="+value2);

At the jsp you can use this:

String param1 = request.getParameter("param1");
String param2 = request.getParameter("param2");

When sending data like that use the .getParameter. But that won't work if you have one instance of an object and you want to send the whole thing

If you want to send an instance of an object use this at the servlet instead of the sendRedirect

SomeObject obj = get_from_somewhere;
request.setAttribute("SOME_KEY", obj);

RequestDispatcher dispatcher = request.getRequestDispatcher("user.jsp");
dispatcher.forward(request, response);

At the jsp:

SomeObject obj = (SomeObject)request.getAttribute("SOME_KEY");
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You have already written the code at your previous thread. Click the link that goes to the profile.jsp, call the method that gets the data and display them.
Pass as argument to the method the username. When you login, put the username in the session and get it at that page.

When the user logs in:

session.setAttribute("USER_NAME", user_name_value);

When the user logs out:

session.setAttribute("USER_NAME", null);

Whenever you need the username take it:

String userName = (String)session.getAttribute("USER_NAME");

If the userName is null then no one is logged in. You need to put that in an if statement and redirect to the login page if the username taken from the session is null

And since you have written all that code in the previous thread this should be very easy, because you already go to a page, run a DAO method and display.

And what you have described is the MVC. And it is not like: "MVC is not in my requirements" because it is not something someone asks you not to do. It's a "way" of solving things which you can follow. And that link provided has a very good example of how you should do things.
But that is only an example. If you want to learn JSP, you need to study from a book or a tutorial. Not rely solely on examples and scrip-lets of code taken from here