JSP :: Displaying Different Menu According To Specific User On Same Page
Sep 24, 2014
i am beginner in java and i am making an application in which i want to display menu for 3 different types of users. like when we login i want to check which type of user is this and which menu to show them. for ex. if there is a employee the menu bar has a dropdown which shows activities like fill nomination, see details etc. if it privileged user he is shown a diff menu and if its the admin the dropdown shows some different activities. i want to make it through simple jsp and servlet. i have a table in data base which has types of user predefined with an id how to display that menu according to a specific user.
View Replies
ADVERTISEMENT
Jul 7, 2014
i have a problem with navigating from a link in a primefaces tree menu to a specific page. The explanation is the following: I have a template with the following code :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
[code]....
i had to put a "*" in the from-view-id tag to be able to navigate to the pages specified with the navigation cases. If i put /templates/leftMenu.xhtml insted of * then the navigation doesn't work and i get the error "WARNING: JSF1064: Unable to find or serve resource, /deleteDepartment-page.xhtml."
View Replies
View Related
Sep 29, 2014
I want to send user back to the Login page after idle time of 10 secs. If user clicks again on screen before 10 secs are over, time will automatically reset to new 10 sec and so on...
I want to use the same timeout on multiple pages.
View Replies
View Related
Apr 5, 2014
I have written some error checking code
File name ErrorPage.jsp
<%@ page language="java" isErrorPage="true" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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>Error</title>
</head>
[code]...
I have put error.jsp and badpage.jsp file in public access folder that is web content in eclipsewhen I am running the code I am status code of 500 and not the errorpage.jsp message .
View Replies
View Related
Feb 28, 2014
I am trying to have a program go on one of the stock trading websites and read the number a stock or currency is at and display or save it. I have it reading and displaying the binary code but I don't see how to have it find the numbers I would like to get.
On the site you would have to go on the page and click some tabs to trade and maybe the stock you would like, it doesn't really matter what one it returns as this is more just an idea. Although I would like to have it search out a selected stock eventually to take it to the net level. I think my biggest problem is I can't see how to access the stock numbers in the code. I looked for different click events but don't see how to have a program do this.
I do not intend to have it display all the code like it is now. I just did it like that to see what I was getting. I will just have a small toolbar with options and a display.
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
public class StockTracker {
public static void main(String[] args) {
[Code] ......
View Replies
View Related
Jun 6, 2014
What should i do to create a JSP page that can be visible to some specific user's.
View Replies
View Related
Sep 14, 2014
One of my official site is not disaplying the content in machine#1 IE10 browser.And the same site is showing data in another machine#2. I compared the both machines JRE and JDK settings but no difference found.
how to link the JRE to browser.
View Replies
View Related
Apr 16, 2015
I am currently working on a project where I have a dataTable, containing some of the information for a specific database table, with commandLinks at the side which I need to bring me to a new page(another jsf file that I have to display the relevant information there) and display only the row of data selected. I've been racking my brain about this and have been unable to figure out a way to do it.
View Replies
View Related
Nov 5, 2014
There are two designation named admin and student. I just need to work in coding to open specific page by email of person like done in facebook or any other mail account.
well one thing I have done is that I have matched email,password and type(designation) in my servlet page to database and the program run and also open the page.If email,pass,type matched witn admin than admin.jsp opens up else student.jsp.But but I wants to open the specific pafe by email that shows the profile of logged in user like in facebook it opens.
View Replies
View Related
Apr 20, 2015
I am new to OOP, i am not sure if this is the correct approach or not. Write a class named CreditCard that has (at least) the following member variables:
- name. A String that holds the card holder's name.
- cardNumber. A field that holds the credit card number.
- balance. A double that stores the current credit card balance.
- spendingLimit. A double that stores the spending limit of the card holder.
- Bonus: additional fields that you can think of.
In addition, the class should have the following member functions:
- Constructor. The constructor should accept the card holder's name and card number and assign these values to the object's corresponding member variables. The constructor should initialize the spending limit to $2,000 and the balance to $0.
- Accessors. Appropriate accessor functions should be created to allow values to be retrieved from an object's member variables.
- purchase. This function should add the amount specified as a parameter to the balance member variable each time it is called.
- increaseSpendingLimit. This function should add 500 to the spendingLimit member variable each time it is called.
- payBill. This function should reset the balance to 0.
- Input validation: Whenever a credit card number is modified, verify that it is of reasonable length.
Demonstrate the class in a program that creates a CreditCard object and allows the user to change and view the state of the credit card with a menu driven program.
View Card Information.
- Purchase an Item: ask the user the purchase amount and increase the card balance accordingly.
- Pay Bill: call payBill method to set the balance to 0.
- Increase Spending Limit: ask the user how much the spending limit should be, and call the increaseSpendingLimit function the appropriate number of times.
[CODE]
import java.io.*;
import java.util.Scanner;
public class CreditCard
{
Scanner input = new Scanner(System.in);
//data members
private String holderName;
private int cardNumber;
private int accountBalance;
private double spendingLimit;
[Code] ....
View Replies
View Related
Aug 14, 2014
I want to read json file as follow;
{
"M": {
"row": [
{
"col1": "c00"
},
{
"col1": "c10",
"col2": "c11"
},
{
"col1": "c20",
"col2": "c21",
"col3": "c22"
}
]
}
}
Next to reading I need to assign to two dimensional array, but without giving "col1","col2","col3" a lot.
The array is for example, Array[3][] = {{"c00"},{"c10","c11"},{"c20","c21","c22"}};
View Replies
View Related
May 1, 2014
I am trying to write a simple program that checks if a user's input has a specific letter using the ".contains" method but its not doing what i wanted to do. here is my code below.
import java.util.Scanner;
public class secret
{
public static void main(String args[]) {
Scanner sc;
char hidden='a';
String guess;
[Code] ....
View Replies
View Related
Apr 29, 2015
I made an application and i can send the message/notification to all loggedin users immediately. But the problem is that i am unable to send notifications to a specific user; as an example facebook chat.I am using Servlets 3.0, Spring MVC 3.0, GSon and AJAX Jquery.
Here is my code:
web.xml
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
[code]....
View Replies
View Related
Jan 21, 2015
This program simply adds integers to an ArrayList and then prompt the user if they would like to delete specific numbers that they don't want.
The output that I get when I want to delete numbers like 2 and 4 from 1 2 3 4 5 is 1 2 3 4 5 instead of 1 3 5.
Java Code:
import java.util.ArrayList;
import java.util.Scanner;
public class AL
{
// A regular array like int arr[] has to have its size declare before run-time and it's not dynamic which mean it can not grow or expand on its own.
static Scanner input = new Scanner(System.in);
// You have to use reference types(Integer, Double, Float); not primitive types(int).
[Code] .....
View Replies
View Related
May 15, 2014
I put link using JQuery on Home Page,
<div class="list_block1" >
script type="text/javascript" src="js/jquery.leanModal.min.js"></script>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" />
<link type="text/css" rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/postoffer.css" media="all"/>
<div class="container">
<a id="modal_trigger" href="#modal" class="btn">Click here to Login or register</a>
<%
[Code] ....
View Replies
View Related
Oct 5, 2014
I'm having some difficulty with my bank account project. I'm supposed to create a menu where the user can create a new account, withdraw, deposit, view their balance, and exit. There's issues with the account creation.
Here's my necessitated class below: BankAccount, TestBankAccount, SavingsAccount, CurrentAccount, and Bank
/*---------------------------------------------------
Plagiarism Statement
I certify that this assignment is my own work and that I have not copied in part or whole or otherwise plagiarized the work of other students and/or persons.
----------------------------------------------------------*/
package BankAccount;
import java.util.Date;
import java.util.Random;
//Project 3
public class BankAccount {
protected static int accountID;
[code]....
View Replies
View Related
Feb 1, 2013
Previous page can be seen even after user logs out from the JSP page.
My code is:
Logout.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
<head>
<title>JSP Page</title>
[Code] ....
how to resolve this?
View Replies
View Related
Jan 29, 2014
I am trying to write a specific byte sequence to a specific memory location on a removable storage drive. Does Java allow me a way to do this? I know the dangers in accessing memory, but the memory location of the data that will be written will never change.
how to assign a variable a memory location.
View Replies
View Related
Nov 5, 2014
How do I move focus from a jcombobox to a specific component say a jtextarea.
My attempt below seems to be moving to a random component not the desired jtextarea.
takenByCombo.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_TAB ) {
e.consume();
dayJTArea.requestFocus(); // focust not moving dayJTArea
}
}
});
I applied the above logic to move focus from a specific jtextarea to another jtextarea as seen below and it works as desired.
dayJTArea.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_TAB ) {
e.consume();
monthJTArea.requestFocus();
}
}
});
View Replies
View Related
Apr 20, 2015
I need to write out code for a seat booking system. So far I have the seats displayed but when I ask the user to enter their seat column and row I don't know how to mark out that specific seat they have booked with an X or such? This is what I've done so far.
import java.util.Scanner;
public class show2
{
public static final int column = 20;
public static final int row = 10;
public static void makeReservations(int[][] seatarray, Scanner input)
[Code] ....
View Replies
View Related
May 30, 2014
I am making a shopping cart app in JSP and servlets to bring it all together. Finally.
I have a registration servlet (c1), a registration form jsp (c2), a login jsp (c3). c1 checks if a username is in the database or not.
If the username is not there, then register the user and send them to c3. I want c3 to display a "registration successful" message if a user has just registered successfully and is coming from c1. ELSE, take the user back to c2 with a message which tells them to choose a different username or password etc.
How do I implement the logic of showing a message depending on where a user is coming from ? The servlets and jsps are ready and I only need to add this logic for a custom message. Of course, I could make a JSP for Registration Successful and one for Registration Failure. But, that seems to be unnecessary.
View Replies
View Related
Feb 9, 2015
So here we go with my problem:
- from the main class will arrive three variable (String name_used, int level_choose, int level_result)
I have a .txt file with this kind of formatting:
mario 1 1 0 1 0 1
carlo 0 0 0 1 1 0
...
Where I use 1 and 0 in the main for write if the level (you see that the numbers are always sixr? are egual to six level existing) BEFORE is done correct or wrong
- when in the main a user make a level a feedback coming back from the class level saying if the user made the count correctly or wrong. and i wanna replace the value (1 or 0) in the txt file with the new level result.
So i have all what i need as parameters i think.
name_used to look for the correct line in .txt file with .indexOf
level_choosed to go throught the correct index of that line
level_result (1 or 2) to be replaced with the existing one
Java Code:
public void salvaRisultati(String name_used, int level_choosed, int result_of_level) throws FileNotFoundException{
}
} mh_sh_highlight_all('java');
View Replies
View Related
Feb 8, 2015
I have some problem to understand the way to make this:
In my main class a user can save his name in a txt file (and the system initially will add 6 value equals to 0) than he can choose between 6 level and make it.
example of .txt file data:
mario 0 0 0 0 0 0
carl 0 0 0 0 0 0
AT THIS MOMENT i just made other class and they work, is this new one that is hard for me. I'm trying to make a class that:
1- (first method called verificaRisultati) take name_used and level_choosed from the main and go to check in the .txt file if that level before was done right(1) or wrong(0)
and return something like "before you made this level properly" or "before you made this level incorrectly" AND THEN let the user start with the level.
2- (second method called salvaRisultati) at the end of the level i wanna pass the result (correct/incorrect) to another method of this class that will save the value (1 or 0) associated to the user in the right position.
This is the class that i'm writing:
Java Code:
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
public class ResultUsers {
[Code] ....
I really need some hint and some code example because I'm stuck. How I can take exactly the line with the user name? How I can correctly split the line in an array and then read/modify the value for that level?
View Replies
View Related
Jun 20, 2012
I got one task from my manager, regarding browser back button, refresh button. He asks me the web application has to work like Banks site... means if I refresh or click on Back button(Browser's) then it has to throw the user out of session, I checked lot in internet. But I found like only disabling back button of disabling F5 keys like that. But he’s not accepting that.
How to approach for this? Can we throw the user out of session when he clicks on browser back button or refresh button. I think its possible . But i don't know how to implement.
View Replies
View Related
Jan 31, 2015
I have to implement a system where I have to do almost same processing on a jsp page. The slight differences on the present page is based on whether the current page came from page 1 or page 2. So how can I do this?
View Replies
View Related
Jan 15, 2014
I have a xhtml file that initialization it with ui:repeat tag in realtime.all tags of this page placed under ui:fragment tag.
<edges>
<ui:repeat value="#{graphInfoBean.edges}" var="edge" varStatus="indexVar">
<edge id="#{indexVar.index}" source="#{edge.source}" target="#{edge.target}"
weight="#{edge.weight}">
[Code] ....
When i access to this page and save it as xml in realtime, the tags in xml file saved is empty while it is initialized and everything is working properly.
<edges>
</edges>
How can i access to content of this xhtml page and save it on disk?
View Replies
View Related