Nicolas Flammel

Ranch Hand
+ Follow
since May 05, 2004
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 Nicolas Flammel

When I create a Date object after parsing like...

String eDate = "27-AUG-24";
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yy");
ParsePosition pos = new ParsePosition(0);
sdf.setLenient(false);
java.util.Date endDate = sdf.parse(eDate, pos);
System.out.println(endDate);

When printing the endDate I get the date as
Wed Aug 27 00:00:00 GMT+05:30 1924

Works fine till 26-AUG-24.

But when I do the same after changing the date format like...
String eDate = "27-AUG-2024";
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
ParsePosition pos = new ParsePosition(0);
sdf.setLenient(false);
java.util.Date endDate = sdf.parse(eDate, pos);
System.out.println(endDate);

Here I get correct results.
Tue Aug 27 00:00:00 GMT+05:30 2024

Why is there a descrepancy between the two parsing formats?
19 years ago
Please help me out.
19 years ago
Why do I get "forward() not allowed after buffer has committed." java.lang.IllegalStateException: in my JSP?
19 years ago
JSP
resetToken after performing the insertion does the work for first time only. After that even the save button doesn't submit the form data nor does save and add more.
19 years ago
I have set a session attribute at the end of the action class
session.setAttribute("USERS_ONLY", "usersOnly") after which the JSP page loads and I have a block of code inside the
<sess:existsAttribute name="USERS_ONLY" value="false">
html tags etc...
</sess:existsAttribute>

<sess:existsAttribute name="USERS_ONLY">
html tags etc...
</sess:existsAttribute>

The JSP doe not load properly and when i see the source it displys the contents inside <sess:existsAttribute name="USERS_ONLY" value="false">
tag although the attribute USERS_ONLY exixts. So why does it go inside the first <sess:existsAttribute name="USERS_ONLY" value="false"> tag???
19 years ago
I have a jsp form which has two html:submit buttons 'save' and 'save and add more'. Both submit the form data except that the save button loads another page and save and add more save the data but remains on that very page for more data to be inserted if needed.

I have used saveToken when coming to add page(which has these two buttons) to prevent resubmission of data when going back and clicking on save or when pressing F5.

How do I go about doing the same if one clicks on save and add more button.
If i use tokens then i am not able to save data for the second time when clicked on save and add more as the same page loads AND if i don't use token then pressing F5 after saving data for the first time would re submit the form and there would be duplicate data?
19 years ago
Sure I did.
19 years ago
Changing the property name to all lowercase doesn't seem to rectify the issue. A peculiar thing here is that this exception gets generated only with eMail. All other properties work just fine. I am retrieving the eMail from the database. It comes fine till the action class. And after I set the same email value in the form bean using setEMail("a@aol.com") and print the same using userForm.getEMail(), the value does get printed.
The problem occurs only when the form loads, the email does not get filled in the textfield. In fact the text field itself does not get displayed and all other components after that text field(because of the exception).

This is pretty wierd. Any pther solution people....???
19 years ago
I have an html text tag in my JSP:
<html:text name="manageUserForm" property="eMail" style="width: 380;" >
</html:text>

I am setting the eMail as manageUserForm.setEMail("abc@aol.com) and then going to the JSP page.

I have getters and setters for the property eMail in the manageUserForm bean
and the form bean is in the request.

But when the jsp loads it does not render the text field at all and I get an exception as:
javax.servlet.jsp.JspException: No getter method for property eMail of bean manageUserForm
javax.servlet.jsp.JspException: No getter method for property eMail of bean manageUserForm
at com.caucho.jsp.QPageContext.handlePageException(QPageContext.java:666)
at _jsp._edituser__jsp._jspService(_edituser__jsp.java:1633)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:506)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:222)
at com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:103)
at com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:80)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:165)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96)
at com.xora.fieldservice.common.logic.FsAccessControlFilter.doFilter(FsAccessControlFilter.java:66)
at com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:163)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:534)

What can be the glitch?
19 years ago
When I press F5 after submitting a form and coming to another JSP(and there is not error in form submission), the data of the form(already submitted) gets submitted again i.e. the previous form gets submitted over and over again although the current form on the screen must get refreshed.

How can I prevent this?
When I press F5 after submitting a form and coming to another JSP(and there is not error in form submission), the data of the form(already submitted) gets submitted again i.e. the previous form gets submitted over and over again although the current form on the screen must get refreshed.

How can I prevent this?
[ July 12, 2004: Message edited by: Nicolas Flammel ]
19 years ago
JSP
struts-config.xml
=================
<action path="/add"
type="com.test.presentation.action.ManageUsersAction"
name="userForm" scope="request" validate="true" input="/add.do?actionType=validationFailedAdd" >
<forward name="addPage" path="/jsp/AddUser.jsp"/>
........
</action>

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="validation/validator-rules.xml, validation/user-validation.xml"/>
</plug-in>
===========================================================================
My form bean(UserForm.java)

public ActionErrors validate(ActionMapping mapping, HttpServletRequest request){
ActionErrors errors = new ActionErrors();
errors=super.validate(mapping,request);
return errors;
}
===========================================================================
The action on the button in my jsp:
add.do?actionType=add';

I am getting exception as follows:
===================================
getting exception:
javax.servlet.ServletException: too many servlet includes `/apps/add.do'
at com.caucho.server.http.RequestAdapter.init(RequestAdapter.java:135)
at com.caucho.server.http.DispatchRequest.init(DispatchRequest.java:107)
at com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:165)
at com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:103)
.......................
Any fix?
19 years ago
I have set userId in my form bean and have set the form bean in the request attribute and have forwarded the action to a JSP page from my action class.

In the JSP i have a hidden attribute
<html:form styleId="myForm" action="/edit.do" >
..
....
<html:hidden name='myForm' property='userId' />
...
</html:form>

A button in this form takes to the action class. When I try to get the userId set in the form through
String userId = request.getParameter("userId");
I get null.
Guess the userId is not getting although it shoud be a part of the request..
Where am I going wrong..?
19 years ago
I have a drop-down box
<html:select name="formName" property='userId'>
<options
collection='USERS'
property='USER_ID'
labelProperty='NAME'/>
</html:select>

I can access the property ie userId from the form bean. How can i get the NAME of the user selected also in the action?
19 years ago
How to compare a Timestamp returned from Java code 2004-06-11 00:00:01.0
in a query in Oracle to a date value 2004-06-11 00:00:00.0 in the table .
I have used
select id
from table
where TIME between to_date('2004-06-09 00:00:00','yyyy-mm-dd hh:mi:ss') and to_date('2004-06-11 00:00:00','yyyy-mm-dd hh:mi:ss')

I get a message that hour can be between 1 and 12. But I want to check the time for midnight. How to format the date in SQL query...???