This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques and have Mario Casciaro & Luciano Mammino on-line!
See this thread for details.
Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!

Ayan mallick

Ranch Hand
+ Follow
since Nov 17, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Ayan mallick

I have a situation in modelling a system of online auction like there will be items which will be posted
for auction with their features and all. now there will be bidders bidding for it. Here ultimately when one bid will be accepted that bideer will be attached with that item. now i have an "item" table which stores all details about the item. so how to realise this one to one relationship in jpa annotation. because when item is being posted for auction then i don't know which bidder's bid will be accepted.
so how to use @one to one here using jpa.

or should i model the problem in different way like two table one for auction item posted and item bid accepted. because when bid accpted then i know the bidder details.so there i can use @one to one easily.please give some ideas.
I am new to UML. Now in a web project i want to apply UML class diagram then should i include controller layer also in the UML class diagram or only model layer classes should be there . I am using spring web MVC framework, even if i include controller layer also in the uml class diagram then how to represent spring library specific classes(i. e the hierarchy of spring specific controller classes).

one more thing is when i will draw UML class diagram it will be only one for whole model layer or for every requirement or use case i draw one because if i draw single UML class diagram it's becoming messy as i have too many classes in model layer.

also how many diagram should be fine. Initially i find 1. use case diagram 2. activity / sequence diagram 3. UML class diagram this three are good to go.

please advice.
I have some doubt regarding usage of exception in web application. what i have learnt form here that if there is a chance to recover from exception then use checked exception.

Now could anyone give some example like what sort of recovery we trying to mean here. If one checked exception arise should i just catch it there log it or print stacktrace and rethrow as runtime exception. or just wrap it in servlet exception and throw it. or catch it and show some error message to user and let the processing go like as it is.

I mean whether to show customer an exception page with proper message and there will be link to get back to application. i have doubt regarding the strategy to apply handling checked exception. or should i declare every exception as runtime exception and show an exception page and there will be a link to come back to the application and continue.

or just write one utility class where i will analyse the exception and redirect it to exception page rather than defining it in web.xml. looking for suggestion.
8 years ago
That's what i told for every method call prepare method would be called. now for fist time when you are displaying the form prepare method works fine. but after you fill up the form and submit it. It will go through interceptor stack. so again prepare method is executed which creates a new form instance and you loose all data filled up in form. then before your register method is called validation interceptor is called and it finds validation error.That's why it never reaches up to register method. it finds validation error and redirect you back to input page. remember what happens once all interceptors are executed successfully without any error then only method mapped to action is called.
8 years ago
every thing is happening because of below interceptors




when you implement preparable interface inorder to prepare method it is called before every method on that class executes. so instead of initializing and prepopulating your form inside prepare method you put it inside input method as you could see this method is exempted from validation by validation interceptor.
which is causing your first problem i.e first time when you are viewing that form it's being validated which we don't want.

next problem is happening because again calling the prepare method before it goes to the register method. now what prepare method does send time is that it reinitializes the form which we difinitely don't want because we want the form data. and after that when validation framework works on it it it sees that form fields are not having proper value that's why it redirects you to input page.

so no prepare method. if you really want a prepare method use an input method and along with that use one method called prepareInput this is a convention in struts2 . and in that case if prepare interceptor calls it before calling input method.

There could be other ways to handle such scenario but i know only this one.
8 years ago
I don't see any problem.Don't know why it is not working. make sure you are deploying properly.
8 years ago



i think it is <bean:write > tag instead if you are trying to print values from list.

8 years ago
Are you implementing Action interface from struts jar.It's required because your class must have one execute method with that signature.
if don't want execute method to execute then just provide a default implementation of it. or else extend ActionSupport class from struts jar because it has default implementation of execute method.
8 years ago
It all looks fine but still i would request you to post action class and struts.xml using code tag. If you are running from IDE make sure after changing struts.xml you restart the server because it's supposed to be redeployed.check once whether there is any spelling mistake or not in method name.
8 years ago

<action path="/login"
name="LoginForm"
type="com.therapist.LoginAction"
>



<html:form action="/Login" >



see the diff i think it's because of this. may be just for validation it want to ensure early only that your action is correctly mapped.check once.
8 years ago
Yes that could be done. inside the controller you create json String like this. and put that String in request along with item list. and jsp part will be like this



I have tested it and it's working. yes if we go this way we don't have to call ajax that's a time saver. put your iteration logic inside function because you need to find out what item has been selected that particular object price you need to show.


8 years ago
I think confirmation is implicitly given by showing success page. Do we really need an intermediate confirmation.
8 years ago

There is no Action mapped for namespace / and action name hello.



if this is the error then check whether you have placed struts.xml in classpath or not if in eclipse check whether you put it in src folder or not.
check log after server start up whether it is being loaded or not.

use struts 2 tag lib and check the page view source whether action has been appended by tag lib during translation.

struts.xml looks fine.
8 years ago
I don't know why you don't want an ajax call here. Because one portion of page you want to change dynamically keeping rest unaffected that's what is the idea behind ajax.
8 years ago