Help coderanch get a
new server
by contributing to the fundraiser

Richard Ellison

Ranch Hand
+ Follow
since Jun 04, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Richard Ellison

Hello,
I am working on a Spring-hibernate based web app.I am using a DAO with methods like saveObject(),updateObject() etc.Now I am using the annotation @Transactional at the top of the class.In the DAO,as I mentioned above,I have a method called saveObject().
a Line of code like
sessionFactory.getCurrentSession().save(object);works fine.The record is inserted into the database.

But if a Transaction is started and then use save in that transaction,the insert works too.So I am not clear about the difference between using the annotation @Transactional and starting a separate transaction

public void saveObject(Object persistObject) {
System.out.println("call from the DAO ");
plSessionFactory.getCurrentSession().beginTransaction();
plSessionFactory.getCurrentSession().save(persistObject);
plSessionFactory.getCurrentSession().getTransaction().commit();

}

Please help.

Thanks
Thanks Bear for your response.

The jsp is expressed something like this:

<td >[Add]</td>

It should have been
<td >[Add]</td>

where 0 is the value of i.

Thanks

Richard
13 years ago
JSP
Hi,
I have a jsp with a javascript function.The jsp has a struts based logic iterate tag in it.All I am trying to do is to pass an int value to the javascript function.

The code snippet is something like this:

<jsp:scriptlet>
int i=0;
</jsp:scriptlet>

<html:link styleClass="menu" href = "javascript:testFunc(<%=i%>)" >

[Add]</html:link>



The javascript Function is :

function testFunc(a){
alert("test"+a);

}


But for some reason I get a javascript error.When I do a mouse over on the "Add" link above,the javascript function is being called as
javascript:testFunc(<%=i%>) rather than javascript:testFunc(0).

I know this looks pretty simple but I am not able to figure it out.

Please advise.

Thanks
Richard
13 years ago
JSP
Thanks a lot for your reply.This will help.
13 years ago
Hi,
I have a question about deploying web applications in remote managed servers.Lets say for example I have two web applications-app A and app B.app A is a security based application that is required by app B for login/authentication purposes.Now lets say that app A is deployed on one remote managed server and app B on another remote managed server with both remote managed servers having the same port.Having said that app B needs app A for its functions,will this set up work?

Please advise.

Thanks
Richard
13 years ago
Hello Helen,
Were you able to customize the datepicker?I am trying to do the samething.

Please advise.

Thanks
Richard
13 years ago
Thanks for some tips.

Regards
Richard.
Hello,
How do I design Java applications which talk to a database from the point of view of multithreading.Meaning in case of a situation where data may be updated/retrieved by multiple threads,do I leave it to the database(pagelocks,rowlocks etc) to take care of this situation or should I be taking care to synchronize blocks or methods on the Java side?

Thanks
Richard
Thanks.I was able to resolve ths issue by using the @SequenceGenerator annotation.

Thanks
Richard.
13 years ago
Hello,
I get this exception when I am trying run a simple Spring MVC application insert/update to the Oracle database using Hibernate:
The retrieve works fine.
org.hibernate.exception.SQLGrammarException: could not get next sequence value.

I created a sequence for the table being refered to in the program.

The Model object has the code below:

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "Article")
public class Article {

@Id
@GeneratedValue
@Column(name = "Article_id")
private Long articleId;

@Column(name = "Article_name", nullable = false, length=20)
private String articleName;

@Column(name = "Article_desc", nullable = false)
private String articleDesc;

@Column(name = "Date_added")
private Date addedDate;

public Article() {
}

public Long getArticleId() {
return articleId;
}

public void setArticleId(Long articleId) {
this.articleId = articleId;
}

public String getArticleName() {
return articleName;
}

public void setArticleName(String articleName) {
this.articleName = articleName;
}

public String getArticleDesc() {
return articleDesc;
}

public void setArticleDesc(String articleDesc) {
this.articleDesc = articleDesc;
}

public Date getAddedDate() {
return addedDate;
}

public void setAddedDate(Date addedDate) {
this.addedDate = addedDate;
}
}


Also,the code which updates the DAO looks like this:

// To Save the article detail
public void saveArticle(Article article) {
//article.setArticleId(new Long(100));
article.setAddedDate(new Date());

sessionFactory.getCurrentSession().saveOrUpdate(article);


}


Do I need a separate mapping file?

I am not sure.

Please advise.

Thanks
Richard
13 years ago
Thanks a lot.I was able to resolve the issue.

Thanks
Richard
13 years ago
Thanks for your reply.I am not sure if Weblogic 9.2 supports jstl or jstl1.2.Anyways,when I try to use either I get the same issue.After going through the links which you provided,I now intend to go through all the folders under Weblogic and remove any references to jstl.jar and standard.jar.This is assuming that Weblogic 9.2 supports jstl and not jstl.jar.

Thanks again for your help.

Regards
Richard.
13 years ago
Hello,
I have created a simple spring mvc based application and have deployed it in Weblogic 9.2.At run time,I see the following error:

java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
at org.springframework.web.servlet.support.JstlUtils.exposeLocalizationContext(JstlUtils.java:97)
at org.springframework.web.servlet.view.JstlView.exposeHelpers(JstlView.java:135)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:211)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1060)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3231)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2002)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1908)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1362)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

Alongside many jar files,I am using jstl.jar.Not sure if this is causing the issue.Do I need standard.jar too?


My web.xml looks like this.

<?xml version="1.0" encoding="UTF-8"?>
<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">
<display-name>
spring3mvcweb</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>


<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>


</web-app>


Any tip is welcome.

Thanks
Richard.
13 years ago
Hello,
How do I ensure that a value which is of a BigDecimal datatype always has 3 digits.Meaning-if the value is 5 then the displayed value should be 005.
If 0,then the value should be 000.

Can a BigDecimal datatype be used or should I use another datatype?

Thanks
Richard
13 years ago
Hello,
Will data be retrieved from a table in Oracle in the same order that it was inserted?I have a situation where I have a table with a column "AccountType".Now this field has values like "New","Amend","Closed" etc.How can I ensure that when records are being retrieved from this table,the record with an "AccountType" value of "New" is the first row followed by the one with "Amend" etc.I know that using "Order By" in the SQL query is the way to go but I am not sure as to how it will work on Strings.Also please note that there is no other field available in the table - like a date field that may be used for Sorting.

Please advise.

Thanks
Richard