>> Wednesday, October 13, 2004 2:49:13 PM - Comments by satya
Should I use a servlet or a JSP?
Should I use a servelt or a JSP to do my work. Which is preferable?
- Mahaveer
>> Wednesday, October 13, 2004 5:06:02 PM - Comments by satya
If you are playing around with things as what servlets can do, JSP is not a bad option. In JSP, you just write a jsp page and put it in the path and you are ready to go. But JSPs gets compiled at run time so you won't know if there is anything wrong with JSPs until you access them.
Servlets on the other hand gives a compile time environment and a finer control over what you want to do. But to effectively work with servlets you need a java IDE and also preferably you have to define them to the servlet container via the web.xml file.
JSPs being optimized for presentation they are not suited for business logic that much. Mainly exception handling and IDE support comes in the way.
So what people normally do is to use only a limited number of servlets for a website and have these servlets process data and then call a JSP page for painting the data. For example all web requests can be sent to a single servlet called a controller servlet and then the controller servlet based on some configuration call a java class that does the action and collect data and then forward the request to a JSP page. This type of architecture is called the Model 2 architecture.
In Aspire for instance there are three servlets. One for displaying data and one for updating data and one for testing purposes. Potentially you can get away with one. But I have three.
Please do respond if you have any follow up questions
Satya
>> Friday, October 15, 2004 11:14:52 AM - Comments by sarayu
Mailing from JSP
I had used the Absolute path for getting the URLStringReaderPart like http://localhost:8080/.... but i found the same error like
info: root cause - com.ai.application.interfaces.RequestExecutionException:Error: reading url:http://localhost:8080/....
>> Friday, October 15, 2004 10:36:33 AM - Comments by satya
Ramesh, Please append here the properties file and also the exception trace from the log file. I will also check my email if you have emailed that stuff.
Were you able to type that url in the browser and saw your web page on the screen?
Satya
>> Friday, October 15, 2004 10:58:26 AM - Comments by satya
Ramesh, I have just tested it with the following
request.TestReader.classname=com.ai.parts.URLStringReaderPart request.TestReader.URL=http://localhost:8181/akc/index.html request.TestReader.resultName=test
See if you can do something similar with a known working url. Pay attention to the log file and try to get to the root cause. See the java trace.
You can cut and paste your log file here if you put them between pre tags. Here is an example
example line1 example line 2
Satya
>> Saturday, October 16, 2004 12:04:04 PM - Comments by sarayu
Mailing from JSP
sir Iam sending the properties file and the log file for checking the errorsDisplayURL=/jsp/display.jsp DisplayURL.formHandlerName=DisplayURLFORM DisplayURL.transformType=jsp request.DisplayURL.transform.className=com.ai.jsp.JSPTransform request.DisplayURLFORM.form_handler.class_request.className=com.ai.htmlgen.DBHashTableFormHandler1 request.DisplayURLFORM.mainDataRequest.className=com.ai.db.DBPreTranslateArgsMultiRequestExecutor request.DisplayURLFORM.mainDataRequest.db=testDB request.DisplayURLFORM.mainDataRequest.query_type=select request.DisplayURLFORM.mainDataRequest.request.1=getdeltab2 request.DisplayURLFORM.mainDataRequest.request.2=getbilltab2 request.getdeltab2.className=com.ai.db.DBRequestExecutor2 request.getdeltab2.query_type=select request.getdeltab2.stmt= \ SELECT Order_id as idD,C_name as NameD,Street as StD,City as CiD,State as StaD,Country as CouD,Zip as ZipD,Phone as PhD,Mobile as MobD,Email as EmD from order_del where Order_id={ordid} request.getbilltab2.className=com.ai.db.DBRequestExecutor2 request.getbilltab2.query_type=select request.getbilltab2.stmt= \ SELECT Order_id as idB,C_name as NameB,Street as StB,City as CiB,State as StaB,Country as CouB,Zip as ZipB,Phone as PhB,Mobile as MobB,Email as EmB from order_bill where Order_id={ordid} DisplayURLFORM.loopNames=cartdetailsloop2 #request.DisplayURLFORM.cartdetailsloop2.class_request.className=com.ai.htmlgen.RandomTableHandler7 request.DisplayURLFORM.cartdetailsloop2.class_request.className=com.ai.htmlgen.GenericTableHandler6 request.DisplayURLFORM.cartdetailsloop2.query_request.className=com.ai.db.DBRequestExecutor2 request.DisplayURLFORM.cartdetailsloop2.query_request.db=testDB request.DisplayURLFORM.cartdetailsloop2.query_request.stmt= \ SELECT product_id,pname,user_id,qty,size,color from basket where user_id = {useid1} #Identify the server side action #In this case it is a pipeline request.sendMailRequest.classname=com.ai.db.DBPreTranslateArgsMultiRequestExecutor request.sendMailRequest.db=testDB #Identify where to go next request.sendMailRequest.redirectURL=http://localhost:8080/avada/display?url=DisplayURL&ordid={ordid}&useid1={useid1} request.sendMailRequest.failureRedirectURL=http://localhost:8080/avada/display?url=FailCartURL ## Define the pipeline request.sendMailRequest.request.1=GetFromToSubject request.sendMailRequest.request.2=GetBodyText request.sendMailRequest.request.3=FinalSendMail ## Get from, to, and subject fields request.GetFromToSubject.classname=com.ai.db.DBRequestExecutor2 request.GetFromToSubject.db=testDB request.GetFromToSubject.stmt=\ select toadd as to1,fromadd as from1,sub as subject from usertable1 where useid={useid1} # GetBodyText # USing the URLStringReader to retrieve a url as a string request.GetBodyText.classname=com.ai.parts.URLStringReaderPart request.GetBodyText.URL=http://localhost:8080/avada/display?url=DisplayURL&ordid={ordid}&useid1={useid1} request.GetBodyText.resultName=bodyText ##Expected inputs ##from, to, subject, bodyText #Finally invoke the mail executor to send the mail request.FinalSendMail.classname=com.ai.aspire.utils.MailRequestExecutor request.FinalSendMail.smtpMailHost=smtp.eth.net request.FinalSendMail.user=******* request.FinalSendMail.password=*******
and this is the log file where i got the errors...Arguments in to the statement are : {url=DisplayURL, request_name=sendMailRequest, aspire_response=org.apache.coyote.tomcat5.CoyoteResponseFacade@1faa614, aspire_request=org.apache.coyote.tomcat5.CoyoteRequestFacade@ad7d80, profile_uid=2, useid1=2, ordid=3434, sendmail=SendMail, aspire_session=org.apache.catalina.session.StandardSessionFacade@a6d35, aspire.reserved.jdbc_connection=com.mysql.jdbc.Connection@1533c8, aspirecontext=avada, prodid1=20, profile_user=annonymous} 10/15/04 10:39 AM: statement to execute : select toadd as to1,fromadd as from1,sub as subject from usertable1 where useid=2 10/15/04 10:39 AM: Trace:RSDataRow/getValue Request for column index 0 10/15/04 10:39 AM: Trace:RSDataRow/getValue return [email protected] 10/15/04 10:39 AM: Trace:RSDataRow/getValue Request for column index 1 10/15/04 10:39 AM: Trace:RSDataRow/getValue return [email protected] 10/15/04 10:39 AM: Trace:RSDataRow/getValue Request for column index 2 10/15/04 10:39 AM: Trace:RSDataRow/getValue return value=congratulation ramesh 10/15/04 10:39 AM: Info:RSDataRow/getValue request for column to1 10/15/04 10:39 AM: vectorMetadata: Request for column : to1 10/15/04 10:39 AM: vectorMetadata: Returned index for column : 0 10/15/04 10:39 AM: Info:RSDataRow/getValue request for column from1 10/15/04 10:39 AM: vectorMetadata: Request for column : from1 10/15/04 10:39 AM: vectorMetadata: Returned index for column : 1 10/15/04 10:39 AM: Info:RSDataRow/getValue request for column subject 10/15/04 10:39 AM: vectorMetadata: Request for column : subject 10/15/04 10:39 AM: vectorMetadata: Returned index for column : 2 10/15/04 10:39 AM: Creating the creator :com.ai.parts.URLStringReaderPart 10/15/04 10:39 AM: Info:BaseServlet servicing: http://localhost:8080/avada/display 10/15/04 10:39 AM: Inside get user 10/15/04 10:39 AM: auth: Http authentication active 10/15/04 10:39 AM: Authorization :null 10/15/04 10:39 AM: db: Could not execute the request for : request.sendMailRequest 10/15/04 10:39 AM: cp: Returning connection for pool testDB 10/15/04 10:39 AM: com.ai.application.interfaces.RequestExecutionException:Error: reading url:http://localhost:8080/avada/display?url=DisplayURL&ordid=3434&useid1=2 com.ai.db.DBException:RequestExecution failed com.ai.application.interfaces.RequestExecutionException:A database error is being reported com.ai.application.interfaces.RequestExecutionException: com.ai.application.interfaces.RequestExecutionException:Error: reading url:http://localhost:8080/avada/display?url=DisplayURL&ordid=3434&useid1=2 com.ai.db.DBException:RequestExecution failed com.ai.application.interfaces.RequestExecutionException:A database error is being reported at com.ai.db.DBBaseJavaProcedure.executeRequest(DBBaseJavaProcedure.java:240)
I had checked by copying the URLStringReaderPart as http://localhost:8080/avada/display?url=DisplayURL&ordid=3434&useid1=2 iam able to see the page but by the program iam getting the error i could not get the problem sir,
Thank You Sir,
Ramesh
Satya - Saturday, October 16, 2004 10:02:57 AM
I will take a look into it in the next hour or so
I will take a look into it in the next hour or so
Satya
annonymous - Saturday, October 16, 2004 10:05:44 AM
Use html "pre" tags to format your properties and log files
Ramesh,
You can use html pre tags so that you don't have to wrap the lines. Read a little bit about pre tags to put your code segments
Satya - Saturday, October 16, 2004 10:14:40 AM
Ramesh, I need two things.
Ramesh, I need two things.
1. See if you can send me the entire exception trace. 2. Try a simpler url like http://localhost:8080/avada/somefile.html
Just put the whole exception trace in the log file in pre tags and you can post it here. Otherwise send it to me in an email.
Satya - Saturday, October 16, 2004 10:22:57 AM
I am going to upload a new jar file
Ramesh, I am changing the urlstring reader part so that it can spit out more errors that might tell us why it is not able to read that URL. I will do that in the next two hours or so. I will post a note here when that happens.
Thanks for your patience.
Satya - Saturday, October 16, 2004 10:26:20 AM
Don't send the stack trace yet
Don't send the stack trace yet, because the trace from the new jar will be more informative. So wait for that one.
Satya - Saturday, October 16, 2004 10:41:58 AM
Repeat your test with the following jar file
Put this jar file in your web-inf/lib. Remove the previous aspire jar file from that directory.
Then repeat your test.
This time the exception should tell us more about why urlstring reader failed. When you send me that exception make sure to include the complete trace of it.
My suspicion is that this URL is accessible only after you login. That means you may have to make this URL a public url and then try to access it. We will do that later. Let us confirm that is the issue first.
Satya - Saturday, October 16, 2004 12:28:06 PM
This is a test message
How about this
Satya - Sunday, October 17, 2004 9:06:17 AM
This is another test message
This should be ok
Satya - Monday, October 18, 2004 9:42:23 AM
If you use DefaultSessionSupport1 ..
Ramesh, You have to set the aspires logged in status to true to allow access to private pages.
Take a look at this note
annonymous - Monday, October 18, 2004 9:54:27 AM
How to declare some URLs as public URLS
The following note explains the process of defining some urls as public urls
Ramesh - Thursday, October 21, 2004 7:55:40 AM
You can not use a column name or alias that is from
Satya take a look at the following files to support this
Satya - Saturday, November 13, 2004 10:05:08 AM
Ramesh why are you not using the JSP route?
See my answers appended to your note.
See if you can actively talk about these issues so that we can resolve this quickly.