krishan go

Greenhorn
+ Follow
since May 20, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by krishan go

This is a simple program where i create two tables in a database using jdbc and sql.



on executing the code i get an "SQL ERROR" from the catch block.on further investigation i see that the error is from the /*error line*/ which i marked. what am i doing wrong???

-krishan


Moderator comment: I have edited your post to add code tags and to apply proper indenting..
They make your code more readable.
Please use code tags around your code for your future posts.
hi,

My inputname.jsp file

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<head>
<title>enter your name page</title>
</head>
<body>
<f:view>
<h1>
<h: outputText value="JSF 1.2 Tutorial"/>
</h1>
<h:form id="UserEntryForm">
<h: outputText value="Enter Your Name:"/>
<h:inputText value="#{UserBean.userName}" />
<h:commandButton action="welcome" value="OK" />
</h:form>
</f:view>
</body>
</html>

My welcome.jsp file
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<html>
<head>
<title>Welcome</title>
</head>
<body>
<f:view>
<h3>
<h: outputText value="Welcome" />,
<h:outputText value="#{UserBean.userName}" /> to JSF 1.2 World!
</h3>
</f:view>
</body>
</html>


my web.xml file

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">


<web-app>

<!-- 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>

</web-app>


my faces-config file

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

<faces-config>

<navigation-rule>
<from-view-id>/user/inputname.jsp</from-view-id>
<navigation-case>
<from-outcome>welcome</from-outcome>
<to-view-id>/user/welcome.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>UserBean</managed-bean-name>
<managed-bean-class>net.roseindia.UserNameBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>

</faces-config>


my UserNameBean.java file

package net.roseindia;

public class UserNameBean {

String userName;

/**
* @return User Name
*/
public String getUserName() {
return userName;
}

/**
* @param User Name
*/
public void setUserName(String name) {
userName = name;
}
}


when i open inputname.jsf i get
Enter your name: #{UserBean.userName}

instead of evaluating userbean.username it is just printing it
same happens at welcome.jsf
i get Welcome, #{UserBean.userName} to JSF 1.2 World!

what am i doing wrong
Please help
Krishan
12 years ago
JSF
Hi,
the following code line is not being evaluated


<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<h: outputText value="#{UserBean.userName}" />to JSF 1.2 World!
i have stored the bean value as "welcome"
i should get the output as welcome to jsf 1.2 world

but i am simply getting
#{UserBean.userName} to JSF 1.2 World!

what am i doing wrong

Please help
Krishan

12 years ago
JSF
hey im recievin the following error
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:500)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:428)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

for the jsp
<jsp:useBean id="obj" scope="session" class="calen.table"/>
<A > GO TO PREVIOUS DAY </A>
CURRENT DATE:<%= obj.getDate() %>
<A > GO TO NEXT DAY </A>
<table border=1>
<tr>
<th>TIME</th>
<th>Appointment</th>
</tr>
<% for(int i=0;i<12;i++)
{
String time=obj.getTime(i);
%>
<tr>
<td>
<A obj.getTime(i) %>><%= obj.getTime(i) %></A>
</td>
<td>
</td>
</tr>
<%
}
%>
</table>
</BODY>


</HTML>

help guys please...

Krishan
12 years ago
JSP
please reply...
wat does ignoresqlexception() do
actualy the statement is
if (ignoreSQLException(((SQLException)e).getSQLState()) == false)
how does ignoreSQLException return a boolean value...

forgive me for bein such a noob...
ya it was pretty stupid of me :p
wat is the meaning of
if((((SQLException)e).getSQLState()) == false)
where e is an instance of SQLException


Krishan