• Post Reply Bookmark Topic Watch Topic
  • New Topic

the jsp thing  RSS feed

 
jay akhawri
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

thanks for ur suggestion. Well i am sorry i didn't made my problem clearer in my last post. but here is the design,


see i made a jsp (call it page 1) which has two forms, one for basic search and other for advanced search.there are two hidden fields(formOption=basic & formOption=advance ) in each of the form basic and advanced so that you can distinguish the forms.

here is the situation

jsp1 ----------> SearchController ----+---searchBasic()--->page2
|
+---searchAdvanced()-->page3

page1 sends a request to a servlet called "SearchController" -> this class has two methods
1. searchBasic(String EID)--- takes the EID of the employee and gives exact info about employee. which i later forward using request dispatcher to another jsp (call it page2)

2. searchAdvanced(request,response) ---- takes various search criteria from page1 (after SearchController finds it's a request from advanced search form). now this method do all the database querys (within the servlet itself) and generates a list of possible employees with their name and EID from the employee table..

-----------
EID || name
-----------
E0 jay
E1 jeanne
--------------

in a jsp (call it page3).

Now what i am trying to do is that, if you click on EID = E0 in page3 => this must call servlet's basic search method(.... for which i tried to reconstruct the querystring which failed..???) which will generate page2 as a result.

after EID is clicked



jsp1 ----------> SearchController ----+---searchBasic()--->page2
^ |
| +---searchAdvanced()-->page3--+
| |
| (parameter EID) |
+----------------------------------------------+


Bye
Jay
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jay,

Two things:

1.) It's a lot easier for everyone involved with the conversation if the issue is kept to one thread. Use the "Add Reply" button to keep from starting a new topic.

2.) In the original thread:
http://www.coderanch.com/t/287151/JSP/java/getting-more-dynamic-result-page
Ms. Boyarski mentioned doing the processing (querying and such) in the servlet and then passing the results to a JSP page for formatting. This is called the MVC pattern (It's almost an MVC pattern).

I have both a real simple MVC demo app and a more involved on that does something similar to what you're talking about. It presents a list of options. When the user chooses one, it does a lookup to get the data specific to that choice.

Look for SimpleMVC and dynamicSelectLists on http://simple.souther.us
[ May 08, 2005: Message edited by: Ben Souther ]
 
jay akhawri
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Ben,

thanks for ur reply.I will take care of what you suggested about threding everything in one.

have a nice day.
cya
 
jay akhawri
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ben,

i am facing a little problem in running DynamicSelectionList servlet you guided me for.

here is the full stack trace

==========================================================================

2005-05-09 12:36:31 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
2005-05-09 12:36:32 StandardContext[/jsp-examples]ContextListener: contextInitialized()
2005-05-09 12:36:32 StandardContext[/jsp-examples]SessionListener: contextInitialized()
2005-05-09 12:36:32 StandardContext[/servlets-examples]ContextListener: contextInitialized()
2005-05-09 12:36:32 StandardContext[/servlets-examples]SessionListener: contextInitialized()
2005-05-09 12:44:56 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@164debb')
2005-05-09 12:44:56 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@15b0333')
2005-05-09 12:44:56 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@2f2295')
2005-05-09 12:44:56 StandardContext[/servlets-examples]SessionListener: contextDestroyed()
2005-05-09 12:44:56 StandardContext[/servlets-examples]ContextListener: contextDestroyed()
2005-05-09 12:44:57 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@c6f734')
2005-05-09 12:44:57 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@8f9a32')
2005-05-09 12:44:57 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@1d47b2b')
2005-05-09 12:44:57 StandardContext[/jsp-examples]SessionListener: contextDestroyed()
2005-05-09 12:44:57 StandardContext[/jsp-examples]ContextListener: contextDestroyed()
2005-05-09 12:45:09 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
2005-05-09 12:45:09 StandardContext[/jsp-examples]ContextListener: contextInitialized()
2005-05-09 12:45:09 StandardContext[/jsp-examples]SessionListener: contextInitialized()
2005-05-09 12:45:10 StandardContext[/servlets-examples]ContextListener: contextInitialized()
2005-05-09 12:45:10 StandardContext[/servlets-examples]SessionListener: contextInitialized()
2005-05-09 12:52:53 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@164debb')
2005-05-09 12:52:53 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@15b0333')
2005-05-09 12:52:53 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@2f2295')
2005-05-09 12:52:53 StandardContext[/servlets-examples]SessionListener: contextDestroyed()
2005-05-09 12:52:53 StandardContext[/servlets-examples]ContextListener: contextDestroyed()
2005-05-09 12:52:53 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@c6f734')
2005-05-09 12:52:53 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@8f9a32')
2005-05-09 12:52:53 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@1d47b2b')
2005-05-09 12:52:53 StandardContext[/jsp-examples]SessionListener: contextDestroyed()
2005-05-09 12:52:53 StandardContext[/jsp-examples]ContextListener: contextDestroyed()
2005-05-09 12:53:08 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
2005-05-09 12:53:09 StandardContext[/jsp-examples]ContextListener: contextInitialized()
2005-05-09 12:53:09 StandardContext[/jsp-examples]SessionListener: contextInitialized()
2005-05-09 12:53:09 StandardContext[/servlets-examples]ContextListener: contextInitialized()
2005-05-09 12:53:09 StandardContext[/servlets-examples]SessionListener: contextInitialized()
2005-05-09 12:56:43 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@a7c45e')
2005-05-09 12:56:43 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@4d2af2')
2005-05-09 12:56:43 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@3e97df')
2005-05-09 12:56:43 StandardContext[/servlets-examples]SessionListener: contextDestroyed()
2005-05-09 12:56:43 StandardContext[/servlets-examples]ContextListener: contextDestroyed()
2005-05-09 12:56:43 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@10c0f66')
2005-05-09 12:56:43 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@c6f734')
2005-05-09 12:56:43 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@8f9a32')
2005-05-09 12:56:43 StandardContext[/jsp-examples]SessionListener: contextDestroyed()
2005-05-09 12:56:43 StandardContext[/jsp-examples]ContextListener: contextDestroyed()
2005-05-09 12:56:57 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
2005-05-09 12:56:58 StandardContext[/jsp-examples]ContextListener: contextInitialized()
2005-05-09 12:56:58 StandardContext[/jsp-examples]SessionListener: contextInitialized()
2005-05-09 12:56:58 StandardContext[/servlets-examples]ContextListener: contextInitialized()
2005-05-09 12:56:58 StandardContext[/servlets-examples]SessionListener: contextInitialized()
2005-05-09 12:57:27 StandardContext[/jsp-examples]SessionListener: sessionCreated('F752FB826F1384F9F509F280C6EA4F0A')
2005-05-09 12:58:01 StandardWrapperValve[HolidaySelectorServlet]: Allocate exception for servlet HolidaySelectorServlet
javax.servlet.ServletException: Error allocating a servlet instance
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:691)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:144)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:536)
----- Root Cause -----
java.lang.UnsupportedClassVersionError: us/souther/select/HolidaySelectorServlet (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:964)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:687)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:144)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:536)

============================================================================
============================================================================


>> Do you think this could be a VERSIONING problem...this is because i used J2SE 1.4 with Tomcat.

>> so i guess answer to my question is COMBININ' scriptlet with javascript, right.


Thanks cya
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I compiled that with jdk1.5.0
You can either upgrade your JVM or recompile with 1.4 and it should work.

I'm not using any 1.5.0 features.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!