Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying a Date in JSP Struts2

 
victor chiong
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
victor chiong
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup,

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

Thanks,
Vic
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic