URGETNT : Login in jsp and New wizard in java client
Hello
i am using jsp tags to develope jsp application, and i need to know how to implément login with tags?
how to launch also the new presentation (graph or table) in my application client,like the same wizard in jdev...
thenks
Within a JSP environment there is currently no option to allow users to create new presentations. This feature has been added to the next release of BI Beans, 10g which is currently in beta testing.
JDeveloper/BI Beans 904 does not include these new presentation JSP tags, however, the user can access presentations stored in the BI Beans catalog. These presentations can be modified by the user from the presentation tool tag that provides the ability to rotate edges and use saved selections to change the status of the dimensions within the presentation.
Hope this helps
Keith Laker
Similar Messages
-
Can we call a workflow form a JSP and/or form a Java Class?
Is it possible to call a workflow form a JSP and/or form a Java Class?
Below is some xpress code I wrote once, used to dynamically lauch workflows from within a workflow. Since it basically uses java classes, you reuse these in your java program or jsp:
- create a new generic object
- call the setId, put, ... methods on it
- set the input variables for the workflow by putting them into the generic object
- call the checkinView method on a LighthouseContext object which launches your workflow.
If all you need is starting a workflow from a jsp, you might also want to take a look at the tasks/taskLaunch.jsp jsp. This is an out of the box jsp which allows launching of tasks. If I remember correctly you have to give an url parameter which specificies the name of task you want to start: tasks/taskLaunch.jsp?id=<workflow-name>
- Robin
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE TaskDefinition PUBLIC 'waveset.dtd' 'waveset.dtd'>
<TaskDefinition name="MVG_TD_LaunchWorkflow" taskType="Workflow" executor="com.waveset.workflow.WorkflowExecutor" suspendable="true" syncControlAllowed="true" execMode="sync" execLimit="0" resultLimit="0" resultOption="delete" visibility="runschedule" progressInterval="0">
<Extension>
<WFProcess name="MVG_TD_LaunchWorkflow">
<Variable name="workflowName" input="true"/>
<Variable name="taskInstanceName" input="true"/>
<Variable name="inputs" input="true"/>
<Variable name="processView"/>
<Activity name="start">
<Transition to="createProcessView"/>
</Activity>
<Activity name="createProcessView">
<Action>
<block trace="true">
<set name="processView">
<new class="com.waveset.object.GenericObject"/>
</set>
<invoke name="setId">
<ref>processView</ref>
<s>ProcessViewer</s>
</invoke>
<invoke name="put">
<ref>processView</ref>
<s>task.process</s>
<ref>workflowName</ref>
</invoke>
<invoke name="put">
<ref>processView</ref>
<s>task.taskName</s>
<ref>taskInstanceName</ref>
</invoke>
<if>
<notnull>
<ref>inputs</ref>
</notnull>
<then>
<invoke name="assimilate">
<ref>processView</ref>
<ref>inputs</ref>
</invoke>
</then>
</if>
</block>
</Action>
<Transition to="checkInProcessView"/>
</Activity>
<Activity name="checkInProcessView">
<Action>
<block trace="true">
<invoke name="checkinView">
<invoke name="getLighthouseContext">
<ref>WF_CONTEXT</ref>
</invoke>
<ref>processView</ref>
<new class="java.util.HashMap"/>
</invoke>
</block>
</Action>
<Transition to="end"/>
</Activity>
<Activity name="end"/>
</WFProcess>
</Extension>
<MemberObjectGroups>
<ObjectRef type="ObjectGroup" id="#ID#Top" name="Top"/>
</MemberObjectGroups>
</TaskDefinition> -
JSP and New Channel Folders with FatWire Spark pCM?
Hello, everbody.
In the FatWire Spark_for_Sun_Developer's_Guide.pdf it is said that Spark Administarotor or Developer can "also write JSPs. Developer defines folders and content classes. Writes JSPs for channels". But nowhere in Spark documentation is describing process of creating new channel directories, JSPs and Java classes in them.
Is it anyway possible to programm new channel and providers in Sun ONE Portal using FatWire Spark pCM ?
If it is possible then where can I get any clear documentation on this process?I think what they mean is that you can create JSP pages to render the data you entered in Fatwire. That JSP are like you said subject to the provider/channel/portlet spec. Within Fatwire you can not program but you could actually use their API in your JSP's.
Enfin, until proven wrong ;-) -
Is it mandatory to send both old and new entity type in case of update procedure?
Hi,
While updating an entity, is it mandatory to send both the new entity and the old entity from the exit to the procedure?
In that case we would have to create 2 temporary tables, insert values into them and then pass the tables to the procedure? Or is there a better way?Hi Ken,
I have followed the instructions on several sites on how to setup using facelets.VIEW_MAPPINGS to use both legacy JSPs and new xhtml files.
My Web.xml now looks like
<web-app>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.jsp</param-value>
</context-param>
<context-param>
<param-name>facelets.VIEW_MAPPINGS</param-name>
<param-value>*.xhtml</param-value>
</context-param>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
and my faces-config looks like
<faces-config>
<application>
<!-- tell JSF to use Facelets -->
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
</faces-config>I have 2 files index.jsp AND guess.xhtml in my apps root directory.
what should my different requests look like in order to access these two resources?
http://localhost/myApp/???
I have also followed the instructions on the following page but still getting resource not available errors
http://www.mojavelinux.com/blog/archives/2006/12/partial_facelets_adoption/
Edited by: JFrain2004 on Jan 30, 2008 8:56 AM -
Online materials for learning Javascript, JSP and EJB
I am a core java programmer, not aware of J2EE stuffs. Please let me know the best online resources for learning Javascript, JSP and EJB
Thanks,
Gautamhttp://java.sun.com/j2ee/tutorial/1_3-fcs/doc/EJBConcepts3.html
http://otn.oracle.com/sample_code/tech/java/codesnippet/j2ee/ejbbestpractices/ejb-best.html#pattern
http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSPIntro.html
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html
http://home.cogeco.ca/~ve3ll/jstutor5.htm
http://www.pageresource.com/jscript/j_a_02.htm
I think will do -
I have a web application.deployed on Tomcat.
the application(JSP page) accepts a login name and password..it works fine from Internet Explorer.
i have a java client and i want to login into the above application from the java client.I specify the login and password in the java client.
I want that the user should be logged in to the web applicationUse the Apache Jakarta Commons HttpClient package which has the ability to handle web application authorization. It is covered in the HttpClient documentation.
-
When a pop up window comes up it is - search bookmarks and history window! I cannot log into my bank as login button should open new window to log in but I get the search page. I cannot see larger images as again I get the search bookmarks and history page etc. Happens on all options that should open new page. I am so frustrated, this has been happening since Firefox updated itself 2 days ago to Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 ( .NET CLR 3.5.30729; .NET4.0C) was fine before that. using windows vista. Can you please advise what I should do? Also can you go back to previous version? Error console eg
Warning: Error in parsing value for 'cursor'. Declaration dropped.
Source File: https://ib.nab.com.au/nabib/styles/menu_nab.css?id=009
Line: 116
ib.nab.com.au : server does not support RFC 5746, see CVE-2009-3555 and Warning: Selector expected. Ruleset ignored due to bad selector.
Source File: https://ib.nab.com.au/nabib/styles/nabstyle.css?id=014
Line: 837
== This happened ==
Every time Firefox opened
== 2 days ago after update.Do you have that problem when running in the Firefox SafeMode?
[http://support.mozilla.com/en-US/kb/Safe+Mode]
''Don't select anything right now, just use "Continue in SafeMode."''
If not, see this:
[http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes] -
Moving a functional jsp and jar file to new directory breaks import?
Simply put - how can I "move" or "copy" a functional JSP directory from the root of my site to a subdirectory
of the same site and have it continue to work?
here are the details:
I have a site where the functional JSP content resides like so ...
c:\site\itworkshere\thetestfile.jsp
c:\site\itworkshere\WEB-INF\web.xml
c:\site\itworkshere\lib\thejarfile.jar
c:\site\itworkshere\classes\props.properties
but when I copy the"itworkshere" directory to c:\site\newdirectory\itworkshere
and try to load thetestfile.jsp page in my browser, I get ...
thetestfile$jsp.java:6: Package com.corporatename.module.io not found in import.
I know that the module.io classes are in thejarfile.jar, but for some reason, now that I've put the files
in a new directory, the import is failing (simple import directive in thetestfile.jsp) And - yes - the .jar
file is there in the new subdirectory.
I am a newbie with jsp and just need to copy the files to new location and have them continue to work.
Do I have to recompile the .jar with some sort of adjustments? I poked around and I don't see any assumptions about the directory structure in the build. The behavior leads me to believe that the build is assuming something
about its location in the directory tree.
Hope this question is clear and I appreciate any direction you can provide to steer me where to look/modify
the necessary changes so I can move the .jsp's and .jar and not break them.Thanks for the suggestions and insights. I have made some progress.
a context path of "/newdirectory/itworkshere" and a docBase of "./newdirectory/itworkshere" has resolved
the .jsp include problem.
However this seems a bit counter-intuitive to me considering that the default root context which is "" stands
at the appBase which in my case is C:\Site. Since the default does not explicitly refer to the "itworkshere" directory,
I'd expect that the newly added Context element would not have to either ---- BUT --- it does require that I include "itworkshere" in the context path and docBase (where I would expect ./newdirectory would have been sufficient since the default works that way) ... am I missing something?
Now I havethe next odd behavior - the Servlet which resides in "itworkshere\WEB-INF\lib" is not loading when I put the appropriate URL in --> /newdirectory/itworkshere/DataCrunchingServlet
I checked the web.xml file and it has the appropriate servlet-name and url-pattern (relative references)
Furthermore I did a test where I simply rename the original working instance directory and again --- the URL is failing to find the servlet!!! (and yes I stopped/started Tomcat) It is as if the servlet can only be found in the originally installed scenario.
I am extremely puzzled that the behaviors seem to indicate an assumption about the path structure, but the web.xml file is set up correctly.
Help help!!! and Thank you.l -
Typical login.jsp, middle_page.jsp and logout.jsp
Hi all,
I have been tring to build a login system in JSP.
The problem is every time the session expires I am
not able to login again immediately and on few
ocassions lots of sessions are opened automatically
which prevents re-loging.
I dont even want to discuss what I did in fear of
confusing you.
So somebody please send me excerpts from a typical
1.)login.jsp
2.) someMiddlePage.jsp
3.) logout.jsp
That really works
I think I am sure about the login and middlepages i.e
-->creating a login.java bean that creates a session and
-->adding userdata into session.
--> and declaring <jsp:usebean id=login class=login scope =session/>
in the middle page and check if the session has valid userid
before serving...
--> I am not sure about the rest..
I think answering this question with a "working code"
can prevent hundreds of other questions that can follow..
Thanks a lot in advance..See: http://www.open-group.biz/xmlportal/Portal?xpc=1$@5$@1$@3
The example is embedded in a portal but the source code is visible on-line.
Good luck! -
Login error in creating new module
I am trying to create a new module to deploy my source objects. The Design repository is on a window client and the Runtime repository is on a UNIX server.
On step 3 of the wizard for creating a data source(New module Wizard) my connection info for the DB link is the following: the name of the user owning the schema where my source tables are located, the name of the host server and the name of the SID as service name. This db is on the UNIX server.
When I enter that user name and password I get a ORA-12514 TNS: no listener error message.
I have triple check all my TNS and listener files on the server and they are all working properly.
Am I using the proper user login for creating a new module. What user login I should be using??
Any help will be greatly appreciated.
Thanks a bunch!
AKAK,
OWB supports two ways of connecting to databases: SQL*Net Connect String or Host Name, you see these choices as a radio button list when creating DB link. SQL*Net Connect String relies on local tnsnames.ora and is more prone to error. We recommend using Host Name connection, where you specify host, port and service name, which is what you are trying to do. Test your connection outside of OWB by typing in your command prompt on the client machine:
sqlplus user/pw@host:port/db_service
If you need further details see this database doc: http://download-west.oracle.com/docs/cd/B14117_01/network.101/b10775/naming.htm#i498306
Nikolai Rochnik -
Remember Login using cookies and javascript
Hello all,
This is an urgent request. Pls reply asap.
I have two jsps one in English and other in french. I need to implement a functionality to remember the username in both these jsps. I have a function written in javascript to check if the "remember me" checkbox is enabled and then remember the user name. But it is not working as expected. It remembers in one jsp and if i go to french jsp all the info is lost.
Can you pls help me? Sample code would help.
I guess the cookie works only for the jsps under certain folder path say en/jsp/.. and fr/jsp/..<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Login Form</title>
</head>
<body>
<form name="login" method="post" action="Home.jsp">
Email : <input type="text" name="email" /><br />
Password : <input type="password" name="password"/><br />
<input type="checkbox" name="rememberChk" value="on" />Remember Me <br/>
<input type="hidden" name="remember" value="0"/>
<input type="button" value="Sumbit" onClick="submitForm()"/>
</form>
</body>
<script>
<%
String email="";
String password="";
Cookie cookies [] = request.getCookies ();//Get All Cookies from Client Device
if (cookies != null){//Check cookies are available
for (int i = 0; i < cookies.length; i++){
if (cookies .getName().equals("password")){
password=cookies[i].getValue();//Password which is saved on cookie
break;
for (int i = 0; i < cookies.length; i++){
if (cookies [i].getName().equals ("email")){
email=cookies[i].getValue();//Email which is saved on cookie
break;
}%>
function submitForm()//Submit function with checkbox determined value
if(document.login.rememberChk.checked)
document.login.remember.value = 1;
else
document.login.remember.value = 0;
document.login.submit();
document.login.email.value="<%=email%>";
document.login.password.value="<%=password%>";
</script>
</html>
login.jsp
<%@ page contentType="text/html; charset=iso-8859-1" language="java"%>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Home Page</title>
</head>
<body>
<a href="logout.jsp">Logout</a><br />
<%
String email;
String password;
String remember;
email = request.getParameter("email".toString());
password = request.getParameter("password".toString());
remember = request.getParameter("remember");
*if Remember Checkbox is Checked
*then Save Email and passwod into Cookie
*and Add Cookies into response/Client Device
if(remember.equals("1")){
Cookie pass = new Cookie("password",password);
Cookie emailAdd = new Cookie("email",email);
//Setting maximum Expiry Date Of Cookies
pass.setMaxAge(365);
emailAdd.setMaxAge(365);
//Make Persistent Cookie onto Client Device
response.addCookie(pass);
response.addCookie(emailAdd);
%>
<h4>Welcome - <%=email%> </h4>
Your password is : <%=password%> <br />
</body>
</html>
Home.jsp
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<html>
<%
Cookie cookies [] = request.getCookies ();//Get All Cookies from Client Device
if (cookies != null){//Check cookies are available
for (int i = 0; i < cookies.length; i++){
if (cookies .getName().equals("password")){
Cookie cookie = cookies[i];
cookie.setMaxAge(0);
response.addCookie(cookie);
break;
for (int i = 0; i < cookies.length; i++){
if (cookies [i].getName().equals ("email")){
Cookie cookie = cookies[i];
cookie.setMaxAge(0);
response.addCookie(cookie);
break;
response.sendRedirect("login.jsp");
%>
</html>
logout.jsp -
JSP AND BEAN PROBLEm java.lang.nullpointerexception help me please
hello i have a problem, when i open login.jsp and enter the form i have nullpointerexception. i don't understand where i wrong... i use tomcat 5.5 ... sorry for my english i'm italian and i speak only italian :(
login.jsp this is the code of the java server page
<html>
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="lavoro" scope="page" class="Ok.Dino"/>
<%@ page session="false" %>
<style type="text/css">
<!--
body {
background-color: #003366;
a:link {
color: #CCCCCC;
.style1 {
color: #000000;
font-weight: bold;
font-size: x-large;
.style4 {font-size: 18px}
-->
</style>
<body>
<%if(request.getMethod()=="GET"){
%>
<form action="login.jsp" method= "POST" name="frmlogin" id="frmlogin">
<div align="center">
<p class="style1">AUTENTICAZIONE</p>
<p> </p>
<table width="318" height="140" border="1">
<tr>
<td width="95" height="60" bordercolor="#000000" bgcolor="#0066CC"><p align="center"><strong>USER</strong></p> </td>
<td width="207" bgcolor="#0099CC"><p align="center">
<input type="text" name="txtnome"></p>
</td>
</tr>
<tr>
<td height="72" bordercolor="#000000" bgcolor="#0066CC"><strong>PASSWORD</strong> </td>
<td width="207" bgcolor="#0099CC"><div align="center">
<input name="pwdtxt" type="password">
</div></td>
</tr>
</table>
<table width="318" border="1">
<tr>
<td width="318" height="87"> <div align="center">
<input name="submit" type="submit" value="invia" >
</div>
<p align="center"><strong><span class="style4">Se non sei registrato fallo <a href="file:///C|/Documents and Settings/access/Documenti/My Received Files/registrazione.jsp">adesso </a></span></strong></p></td>
</tr>
</table>
<p> </p>
<p> </p>
</div>
</form>
<%}else { %>
<%lavoro.settxtnome(request.getParameter("txtnome"));%>
<%!ResultSet rs=null;
String x=null;
%>
<% lavoro.cn_db("dbutenti");%>
<% rs=lavoro.run_query("SELECT user FROM utenti");%>
<%}%>
</body>
</html>and this is the bean code
package Ok;
import java.sql.*;
public class Dino
private String txtnome,pwdtxt;
private Connection cn=null;
private Statement st=null;
private ResultSet Rs=null;
public String gettxtnome()
return txtnome;
public String getpwdtxt()
return pwdtxt;
public void settxtnome(String n)
this.txtnome=n;
public void setpwdtxt(String n)
this.pwdtxt=n;
public void cn_db(String db)
if(cn==null){
//1. Caricamento del driver
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}catch(ClassNotFoundException cnfe){
System.out.println("impossibile caricare il driver");
System.exit(1);
try{
//2. Connessione al DB
cn = DriverManager.getConnection("jdbc:odbc:"+db);
//3. creazione degli oggetti Statement e ResultSet
st =cn.createStatement();
}catch(SQLException e){
System.out.println(e+"jjj");
}else{
System.out.print("errore database gi�� creato");
public ResultSet run_query(String qr)
try{
Rs=st.executeQuery(qr);
}catch(SQLException e)
System.out.print(e+"ecco l'error");
return Rs;
}Do you understand when a NullPointerException will be thrown? This will be thrown if you want to access an uninstantiated Object.
So look to the stacktrace and go to the line where the NPE is been thrown and doublecheck if the object reference is actually instantiated.
Or add a null-check to the object reference:if (someObject != null) {
someObject.doSomething();
}or just instantiate it:if (someObject == null) {
someObject = new SomeObject();
someObject.doSomething(); -
How to send object arraylist from servlet to jsp and display using jstl
Hi All....
I have a simple application and problem with it.
Once user logged in to system the user will redirect to LoginServlet.java controller.
Then in LoginServlet I want to redirect user to another page called book_details.jsp.
this is my login servlet.
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
PrintWriter out = response.getWriter();
ArrayList<BankAccountDTO> account_list = new ArrayList();
ResultSet resultSet = null;
LowFairAirDB airDB = null;
try{
airDB = new LowFairAirDB();
String query = "SELECT account_id, type, description, balance, credit_line, begin_balance, begin_balance_time_stamp FROM bank_account";
airDB.sqlSelect(query);
resultSet = airDB.getResultSet();
while(resultSet.next()){
account_list.add(new BankAccountDTO(resultSet.getInt(1),
resultSet.getInt(4),
resultSet.getInt(5),
resultSet.getInt(6),
resultSet.getString(2),
resultSet.getString(3),
resultSet.getString(7)));
}catch(Exception ex){
}finally{
try{resultSet.close();}catch(Exception ex){}
airDB.sqlClose();
}I set bank account values to BankAccountDTO.java objects and add them to the arrayList.
Next I want to send this objects arrayList to books_details.jsp and wanna display each objects values using JSTL.
I still finding a way to go through this.
1. Can anyone say how can I do it?
2. Is there any other method to do the same thing without using JSTL?
thanks in advance,
Dil.Naishe wrote:
In your servlet,
request.setAttribute("account_list", account_list);
requestDispatcher.findForward("/your/display/jsp");
Good. I would only follow the Java naming conventions. E.g. accountList or accounts instead of the ugly PHP/C conventions.
In the JSP,
lst = (List< BankAccountDTO >)request.setAttribute("account_list");
for(BankAccountDTO b: lst){
populate your HTML tags or whatever
Wrong. 1) You need getAttribute() and 2) you should not use scriptlets. Use JSTL c:forEach, e.g.<table>
<c:forEach items="${accounts}" var="account">
<tr>
<td>${account.id}</td>
<td>${account.type}</td>
<td>${account.description}</td>
</tr>
</c:forEach>
</table>To the topicstarter: for future JSP/JSTL related questions please use JSP/JSTL forum.
Here it is: [http://forums.sun.com/forum.jspa?forumID=45]. -
Problems with JSP and MySql bean.
Hi,
I'm new to JSP and I'm having some problems with it. I'm trying to do a simple login where a java class (bean?) handles the SQL injektion. I have deployed the page on tomcat and it works fine, except that the sqlinjektion does basically nothing. I have installed the mysql driver. I think there is something wrong with the java class, or the way im calling it. It does not produce any error. But its like it would never actually process the java code, because ive tried to append things to error string to see what is going on, nothing happens. everything stay null, no exceptions are thrown. If I implement the code to JSP itself, it does load the driver and print exception that there is no connection to database (which is correct). What am I missing? Code follows:
the sqlhandler:
public abstract class SqlInjektor {
private static String Database = "*****";
private static String serverName = "localhost:3306";
private static String usrName="******";
private static String passw="******";
* @return Connection
public static Connection createConnection(String error){
Connection mySqlCon = null;
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
catch(Exception E){
PrintWriter out = response.getWriter();
out.println("lol");
String url = "jdbc:mysql://" + serverName + "/" + Database + "?user=" + usrName + "&password=" + passw;
try{
mySqlCon = DriverManager.getConnection(url);
catch (Exception E){
E.printStackTrace(System.out);
return mySqlCon;
* Metodi saa sy�tteen��n SQL komennon, jonka se suorittaa sek� palauttaa komennon tulokset.
* @param command
* @return ResultSet
public static ResultSet querySQL(String command,String error, Connection con){
ResultSet rs = null;
try{
Statement stmt = con.createStatement();
rs = stmt.executeQuery(command);
catch(Exception E){
E.printStackTrace(System.out);
return rs;
the jsp page:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page isErrorPage="false" %>
<%@ page import="java.sql.*" %>
<%@page import="ot3.User"%>
<%@page import="ot3.SqlInjektor"%>
<%@page import="Javax.servlet.jsp.*"%>
<!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>vastaanotto</title>
</head>
<body>
<%! String id;
String password;
String error = new String("Error!\n");
User user;
%>
<% user = new User();
session.putValue("currentUser",user);
id = request.getParameter("authName");
password = request.getParameter("Password");
Connection conn=null;
ResultSet rs=null;
conn = SqlInjektor.createConnection(error);
if(conn!=null){
out.println("conn ok!");
rs = SqlInjektor.querySQL("SELECT * FROM user WHERE id='" + id +"' AND password='" + password+"' COLLATE latin1_bin;",error,conn);}
try {
if (rs!= null && rs.next()){
user.setID(rs.getInt("id"));
user.setName(rs.getString("name"));
user.setPassword(rs.getString("password"));
user.setClearance(rs.getInt("clearance"));
if(rs.getString("addedby")!=null)
user.setAdder(rs.getInt("addedby"));
if(rs.getString("lastmodifier")!=null)
user.setModifier(rs.getInt("lastmodifier"));
rs.close();%>
ONNISTU!
<%}
else {
out.println(error);
} catch (SQLException e) {
out.println(e.getMessage());
}%>
</body>
</html>Hi,
I'm new to JSP and I'm having some problems with it. I'm trying to do a simple login where a java class (bean?) handles the SQL injektion. I have deployed the page on tomcat and it works fine, except that the sqlinjektion does basically nothing. I have installed the mysql driver. I think there is something wrong with the java class, or the way im calling it. It does not produce any error. But its like it would never actually process the java code, because ive tried to append things to error string to see what is going on, nothing happens. everything stay null, no exceptions are thrown. If I implement the code to JSP itself, it does load the driver and print exception that there is no connection to database (which is correct). What am I missing? Code follows:
the sqlhandler:
public abstract class SqlInjektor {
private static String Database = "*****";
private static String serverName = "localhost:3306";
private static String usrName="******";
private static String passw="******";
* @return Connection
public static Connection createConnection(String error){
Connection mySqlCon = null;
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
catch(Exception E){
PrintWriter out = response.getWriter();
out.println("lol");
String url = "jdbc:mysql://" + serverName + "/" + Database + "?user=" + usrName + "&password=" + passw;
try{
mySqlCon = DriverManager.getConnection(url);
catch (Exception E){
E.printStackTrace(System.out);
return mySqlCon;
* Metodi saa sy�tteen��n SQL komennon, jonka se suorittaa sek� palauttaa komennon tulokset.
* @param command
* @return ResultSet
public static ResultSet querySQL(String command,String error, Connection con){
ResultSet rs = null;
try{
Statement stmt = con.createStatement();
rs = stmt.executeQuery(command);
catch(Exception E){
E.printStackTrace(System.out);
return rs;
the jsp page:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page isErrorPage="false" %>
<%@ page import="java.sql.*" %>
<%@page import="ot3.User"%>
<%@page import="ot3.SqlInjektor"%>
<%@page import="Javax.servlet.jsp.*"%>
<!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>vastaanotto</title>
</head>
<body>
<%! String id;
String password;
String error = new String("Error!\n");
User user;
%>
<% user = new User();
session.putValue("currentUser",user);
id = request.getParameter("authName");
password = request.getParameter("Password");
Connection conn=null;
ResultSet rs=null;
conn = SqlInjektor.createConnection(error);
if(conn!=null){
out.println("conn ok!");
rs = SqlInjektor.querySQL("SELECT * FROM user WHERE id='" + id +"' AND password='" + password+"' COLLATE latin1_bin;",error,conn);}
try {
if (rs!= null && rs.next()){
user.setID(rs.getInt("id"));
user.setName(rs.getString("name"));
user.setPassword(rs.getString("password"));
user.setClearance(rs.getInt("clearance"));
if(rs.getString("addedby")!=null)
user.setAdder(rs.getInt("addedby"));
if(rs.getString("lastmodifier")!=null)
user.setModifier(rs.getInt("lastmodifier"));
rs.close();%>
ONNISTU!
<%}
else {
out.println(error);
} catch (SQLException e) {
out.println(e.getMessage());
}%>
</body>
</html> -
UmLogonPage.jsp - Add new Button
Hi Portal experts,
I am customizing the Logon Page, umLogonPage.jsp . My requirement to add new button in umLogonPage.jsp and on action it should redirect BSP iview.
Can you help me to implement this. I have downloaded the Par file and imported in NWDS .
Please provide help if possible.Hi Rashi
Go through Modifying The Logon Par(or customising the Logon Screen)
Just search for custom login page in portal and you will get various link on this.For adding new button add the button code in umLogonPage.jsp.You can copy the Submit button code already available and change the source link.
Regards
Shankar
Maybe you are looking for
-
I have a sync key, and have a new computer terminal, but when I enter the account details I created, it syncs nothing with my new computer. How do I fix this? There is nothing showing up when I sync with the sync key from my old terminal.
-
PC Suite 6.86.0 No Connections listed
Hi All, I was using PC Suite 6.85 with an N80 phone on a Bluetooth connection until two days ago, when I received a message that an update of PC Suite 6.86.9 was available. I downloaded this and installed it. Since then I am unable to use the combina
-
How can I delete the Facebook friend list in PSE 11?
I would like to delete the Facebook friend list so it doesn't show up when tagging people in photos. It appears once you authorize Facebook and download your friend list (I inadvertenly left the checkbox checked) there is no way to reset. I tried l
-
Great job, Adobe developers. Only the new highlight recovery is worth the upgrade, at least when dealing with Panasonic GH2 raw files. You can get an impression about it, with my post to German Systemkamera Forum. I post the link here, unfortunately,
-
IPod touch gets music and movies deleted.
This is a new issue with iOS6 and/or iTunes 10.7. I have a 4th gen iPod touch, and twice in the past week it has had all the music and movies (but not apps or pictures) deleted. The only way to fix this is to go to Settings -> General -> Reset -> Era