File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Displaying a Date in JSP Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Displaying a Date in JSP Struts2 " Watch "Displaying a Date in JSP Struts2 " New topic
Author

Displaying a Date in JSP Struts2

victor chiong
Ranch Hand

Joined: Apr 04, 2012
Posts: 73
Hi Guys,

I have a problem in loading a date in struts2.

When i click the link <a href="product.jsp"><span>Input</span></a> , date will not be displayed because the product.action is not yet run.... I still need to click the submit bottom for the date to be posted... It should not be like that....

How can i populate the date field when i click on the href above?

That is the field below.



This does not work, maybe this will be run when I click product.jsp?




Thanks,
Vic
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8707
    
    6

You should not be directly accessing JSP's (you can, but then you can't complain if things don't work). Have a look at this architecture diagram and you'll see that by doing so, you are trying to circumvent the way Struts works.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
victor chiong
Ranch Hand

Joined: Apr 04, 2012
Posts: 73
Hi Joe,

hahaha, checking on your website I had done it all wrong hehehe. Thank you, even the index page should be in action.... So this means that the link that you should click should be the link of the filters.

Thanks,
Vic
victor chiong
Ranch Hand

Joined: Apr 04, 2012
Posts: 73
Hi,

Is this a good practice? Instead of using JSP as a link, i did use action with the method ="initialise" Is this how you guys do it?





victor chiong
Ranch Hand

Joined: Apr 04, 2012
Posts: 73
A problem encountered.. It will produce an error "No result defined for action and result input" because i have a validation() method. I created an "input" and "success" result in the struts.xml on the <action>... It is now okay... but I want that the validation method will not run.. After research, i had found this solution. Using Skip Validation this will skip the validation for the first time it goes to the action.


@SkipValidation
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8707
    
    6

victor chiong wrote:
Is this a good practice? Is this how you guys do it?


Yes, I usually put all the CRUD methods for a particular item in a single action file.
victor chiong
Ranch Hand

Joined: Apr 04, 2012
Posts: 73
Yup,

But how about those initialising forms and displaying data? it is of one method?

Thanks,
Vic
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Displaying a Date in JSP Struts2
 
Similar Threads
Jsp is not displaying in Struts2
validation in struts2
struts2 date conversion question
ajax and struts2
Struts2/JQuery