JSP, tags or beans or what?
Hi,
I have not used jsp's for almost 3 years now but need to return to them. Can anyone advise what the best/most modern way to include POJO output code in a JSP. I am confused as to all the different terminologies. In my mind simplicity is best so let me explain a bit more:
I have a POJO :
public class _displayDrivers {
*public static String get()* {
ObjectContainer db = null;
String out = "";
try {
db = Db4o.openFile("somefile.yap");
List<Pilot> pilots = db.query(new Predicate<Pilot>() {
public boolean match(Pilot pilot) {
return pilot.getPoints() == 100;
Pilot proto = new Pilot(null, 0);
ObjectSet result = db.queryByExample(proto);
out = listResult(result);
} catch (Exception ex) {
} finally {
db.close();
*return out;*
public static String listResult(ObjectSet result) {
String o = "";
while (result.hasNext()) {
o += "<br />" + result.next().toString();
return o;
}And I want to be able to simply, with no fuss, be able to 'dump' the String returned into a JSP sort of like this :
<body>
<% jspCode "_displayDrivers", "get", "(any parameters here)" %>
</body>Nice an neat and easy. and most importantly I can give the graphic designers an 'API' of tags. I have looked at Tag Libraries but these seem overly complicated. I just want to call a method of a class! And beans look way dated.
What is the most up to date way of doing this?
Many thanks
H
Edited by: inabind on Aug 12, 2009 10:35 AM
The best and most modern way is for that POJO to stop generating HTML. Instead it should return the list as a List, via a name suitable for a JavaBean such as getPilots. Then you can use JSTL to iterate through the list and display it in whatever way you choose.
That way the JSP is in charge of the view (what the output looks like to the user) and the POJO is in charge of the data and the two don't interfere in each other's responsibilities.
Similar Messages
-
I can't use JSP tags lib in IWS6
I was trying to use JSP tags lib but the web server doesn't find the *.tld file. Some messages are shown:
25/Jun/2002:19:40:28] info ( 5604): JSP: JSP1x compiler threw exception
org.apache.jasper.compiler.CompileException: /local/iplanet/docs/menu_principal.jsp(1,0) Unable to open taglibrary http://apache.org/taglibs/dbtags : Could not locate TLD http://apache.org/taglibs/dbtags
at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:707)
at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:110)
at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1077)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1042)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:218)
at com.iplanet.server.http.servlet.NSServletEntity.load(NSServletEntity.java:252)
at com.iplanet.server.http.servlet.NSServletEntity.update(NSServletEntity.java:173)
at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:416)
[25/Jun/2002:19:40:28] warning ( 5604): Internal error: Failed to get GenericServlet. (uri=/menu_principal.jsp,SCRIPT_NAME=/menu_principal.jsp)
I have some doubts about how to work with JSP Tags in iws6. What should I do to get this work?
The tag lib is gotten from jakarta project and I'd like to know which steps i have to follow.
Thank you very muchHi,
What you have to do is this:
- Include the jar file in the WEB-INF/lib
- Include the tld file in a directory under WEB-INF, for example tlds
- Create a mapping in the deployment descriptor (web.xml), to make the taglib available, something like this:
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/io</taglib-uri>
<taglib-location>/WEB-INF/tlds/io.tld</taglib-location>
</taglib>
Then in the jsp, you have to invoke it like this:
<%@ taglib uri="http://jakarta.apache.org/taglibs/io" prefix="io" %>
<io:http url="http://mustang:4004/NASApp/fortune/fortune" action="GET"/>
Hope this helps
Juan -
Does weblogic server supports JSP tag pooling
We use lot of Custom Tags in our app, we want improve the performance of JSP pages.
Does Weblogic JSP engine supports JSP Tag Pooling similar to what JASPER (Tomcat
JSP Engine) supports.
If not, is there any way to plug-in my own Tag Pooling classes into JSP Engine.
Thanks
Ramesh
This type of questions are appropriate for the Forms discussion forum.
raghu -
JSP tag collaboration with BI Beans
Hello!
We need to reorganize a dimension hierarchy in runtime during presentation. It's merely a matter of formatting. We use a tag handler that reeds its body doing some operations and puts a new content for body in page.
We tried this
====================
<My:BodyReaderTag>
<orabi:ListCombo renderAs="combo" autoSubmit="true" biList="${tagtest_dimMemList1_data}"/>
</My:BodyReaderTag>
====================
When doing this my tag grabs all content except the output from orabi:ListCombo. It seems like orabi:ListCombo does not push the JspWriter on the stack (by collaboration with orabi:BIBody tag). When, for testing purposes only, I removed the orabi:BIBody tag, I got the result I would like to get.
How can I get the output from orabi:ListCombo tag? Or if that is not possible, where can I find detailed information so I can create my own customized tag handlers that collaborates with BI Beans,
Thanks in advance,
MatsThe implementation of the <orabi:ListCombo> is based on UIX JSP tags technology. It uses an instance of oracle.cabo.ui.RenderingContext created earlier by the BIThinSession tag to do the actually rendering.
May I ask what are you trying to do with the <my:reformatter> tag? The ListCombo tag has attributes like "styleClass" and "inlineStyle" that can be used customize the look and feel of the content it renders. Also, we provide a set of built-in styles. Have you looked into whether you can use "styleClass" or "inlineStyle" attributes to satisfy your formatting needs?
Hope this helps,
Keith
Oracle Business Intelligence Product Management
BI on Oracle: http://www.oracle.com/bi/
BI on OTN: http://www.oracle.com/technology/products/bi/
BI Beans http://www.oracle.com/technology/products/bib/index.html
Discoverer: http://www.oracle.com/technology/products/discoverer/
BI Software: http://www.oracle.com/technology/software/products/ias/devuse.html
Documentation: http://www.oracle.com/technology/documentation/appserver1012.html
BI Samples: http://www.oracle.com/technology/products/bi/samples/
Blog: http://oraclebi.blogspot.com/ -
Hi All,
I just learnt that with JSP 2.0, we do not have to specify the useBean or getProperty tags. We can simple get the job done through........
${key.property}... but this has really started me thinking about the necessity of having getters and setters within beans. What's the point... Because I was under the impression that even validation should not take place within beans. It should be taken care of within a seperate validation file. So provided that the getters and setters just simply return the variable; why bother having them in the first place ?
I am sure this is simply a misunderstanding on my part, therefore I would appreciate an explanation. Thanks.Thank you very much, but with your permission, I'd just like to clarify that I am aware that getters and setters are NORMALLY used for encapsulation, ie desktop applications. But this is not what I am woried about. My problem is with beans. I'd just like to know whether the MVC "pattern" allows this behaviour within them. The only problem I am facing is that I was under the impression that this was not allowed for beans.
So could you simply re-confirm that beans do not demand both getters and setters to be present for every data variable and that it is possible to have some sort of processing ( which I thought was only allowed with servlets ) such as validation within beans.
Much appreciated. -
Need Help: Problem with JSP setProperty to Bean
Hi,
This is my first time posting to this forum so I am not completely aware how Duke dollars work but if anybody can help me I will be happy to give some... whats normal for solving a problem?? 10??
Anyway... the problem...
I have a simple JSP with a simple HTML <form> that has a text field and a Submit button. Submit takes the user to the next JSP page however the setter method for property 'user' is never called. I can verify this through an attached debugger.
I am using Tomcat 5.5, and I never had a problem like this in previous versions of Tomcat.
I have tried changing the scope of the bean to request however nothing changed. I excluded all my business logic and tested this one more time just to make sure I wasn't inadvertadely screwing with something however this still does not work.
I am sure I am missing something small but for the life of me I can't figure out what.
Here is my code:
index.jsp
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<jsp:useBean id="something" scope="session" class="com.db.servlet.UserBean">
<jsp:setProperty name="something" property="*"/>
</jsp:useBean>
<p>Select</p>
<form id="Form1" method="post" action="multi.jsp">
<p>User: </p>
<input type="text" name="user" size="20"><br>
<input type="submit" value="Submit">
</form>
<br><p>Or select Single mode.</P><br>
<a href="tris.html">tris</a>
</body>
</html>UserBean:
package com.db.servlet;
public class UserBean {
private String user = null;
public UserBean() {
public void setUser(String user) {
this.user = user;
public String getUser() {
return user;
}Oops!
I not only realized my mistake, I also accidentally posted this in the wrong forum. I meant to post in the JSP Forum.
For reference, what I did wrong was I placed my setProperty tag in index.jsp rather than placing it in multi.jsp (the file specified in the form action).
Everything works now. -
Experiences developing iViews with JSP tags
Hi,
has anyone experiences in the development of iViews using JSPs and the JSP tags ? Especially the useBean tag... I think it should be no problem to store beans in the session. If I want to share the bean among iView is it enought to synchronized each method of the bean ?
ThanksHi O.,
please, before going on guessing around what synchronization means, read some tutorial, that's what the link was thaught for. It is no problem at all not to know this topic, it's definitely some more advanced topic within the language, but it doesn't help if you don't know it to guess how it <i>could</i> work/behave.
> if I declare all getters and setters of the bean with
> synchronize I avoid the issue of inconsistent data
Once again: For pure getters and setters this sentence is definitely wrong. As long as complex class members are not manipulated / accessed concurrently, there is no need for synchronization (within the class).
> thread 1 sets a value a concurrent thread 2
> could read the data and would get a not actual value...
> if I synchronize the get and set, thread 2 will be
> able to invoke the getter after thread 1 finished the
> setter.
Once again: You don't have it in your hands which thread comes first. And synchronizing a method only means that a thread calling this method will run through it as an atomic operation, no other thread will disturb. But getters and setters normally are atomic, you cannot reach more... If a thread calls two (synchronized) methods of the same object, between these two calls, "the race is open again...".
A good example is http://www-106.ibm.com/developerworks/java/library/j-threads1.html
See the example at the end of this link, that's somehow just what we are talking about. The solution would be to synchronize the <i>setFoo(getFoo() + 1)</i> itself (for example with the bean object as locker). Whereas the synchronization of the methods is superfluous (and time consuming).
Hope it helps
Detlev -
I am having a problem relacing the include file of let's call it a
header.jsp in a menu page named menu.jsp.
So in my header.jsp file let's say I do something simple like
<table>
<tr><td><jato:href name="first">First Option
</jato:href></td></tr></table>
and so on....
And in my main.jsp I have a simple include at the top of my page
like so
<html
<body>
<%include file=header.jsp%>
etc.
Now when JRun 3.0 makes the include replacement, it seems to have a
problem where it tells me
Servlet error 500
com.iplanet.jato.view href : taglib navigation not found
BUT when I take out the jato tags in the include file...I can get
JRun to make the replacement perfectly....
Does anyone else have this problem and if so how did you get around
it?Sorry to bother you again, but I couldn't find anything that looked strange
is this file. Can you send us the original file at our personal email
addresses? I'd like to see exactly where the compilation error occurs and
it's not possible with the file inlined here.
todd.fast@e...
michael.frisino@s...
Thanks,
Todd
----- Original Message -----
From: <suket@u...>
Sent: Wednesday, January 17, 2001 2:02
Subject: [iPlanet-JATO] Re: include jsp tags
Hi Mike,
Both of the jsp files (pgHelp.jsp and pgFooter.jsp)
are in the same folder. I removed the IPP/ipp portion in the
include directive but still giving the same err.
iam using Allair Jrun 3.0.
Here is the intermediary generated Jsp file
/ Generated by JRun, do not edit
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import allaire.jrun.jsp.JRunJSPStaticHelpers;
public class jrun__IPP__ipp__pgHelp2ejsp13 extends
allaire.jrun.jsp.HttpJSPServlet implements
allaire.jrun.jsp.JRunJspPage
private ServletConfig config;
private ServletContext application;
private Object page = this;
private JspFactory __jspFactory = JspFactory.getDefaultFactory();
public void _jspService(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, java.io.IOException
if(config == null) {
config = getServletConfig();
application = config.getServletContext();
response.setContentType("text/html; charset=ISO-8859-1");
PageContext pageContext = __jspFactory.getPageContext(this,
request, response, null, true, 8192, true);
JspWriter out = pageContext.getOut();
HttpSession session = pageContext.getSession();
try {
out.print("\r\n\r\n");
IPP.ipp.pgHelpViewBean viewBean = (IPP.ipp.pgHelpViewBean)
pageContext.getAttribute("viewBean", PageContext.REQUEST_SCOPE);
if(viewBean == null) {
if(JRunJSPStaticHelpers.getAndSetBean(pageContext,
"viewBean", IPP.ipp.pgHelpViewBean.class
, PageContext.REQUEST_SCOPE, 3)) {
viewBean = (IPP.ipp.pgHelpViewBean)pageContext.getAttribute
("viewBean", PageContext.REQUEST_SCOPE);
} else {
viewBean = (IPP.ipp.pgHelpViewBean)pageContext.getAttribute
("viewBean", PageContext.REQUEST_SCOPE);
pageContext.setAttribute("viewBean",viewBean);
out.print("\r\n");
com.iplanet.jato.taglib.UseViewBeanTag useViewBean__4_1 =
(com.iplanet.jato.taglib.UseViewBeanTag)
JRunJSPStaticHelpers.createTagHandler(pageContext,
"com.iplanet.jato.taglib.UseViewBeanTag");
useViewBean__4_1.setPageContext(pageContext);
useViewBean__4_1.setParent(null);
useViewBean__4_1.setClassName("IPP.ipp.pgHelpViewBean");
int useViewBean__4_1_startVal = useViewBean__4_1.doStartTag();
JRunJSPStaticHelpers.checkStartVal
("com.iplanet.jato.taglib.UseViewBeanTag",useViewBean__4_1_startVal,Bo
dyTag.EVAL_BODY_INCLUDE,4);
if(useViewBean__4_1_startVal == BodyTag.EVAL_BODY_INCLUDE) {
com.iplanet.jato.view.ContainerView currentView =
(com.iplanet.jato.view.ContainerView)pageContext.getAttribute
("currentView");
com.iplanet.jato.view.TiledView currentTiledView =
(com.iplanet.jato.view.TiledView)pageContext.getAttribute
("currentTiledView");
out.print("\r\n<HTML>\r\n<HEAD><!--jato:text name=\"stTemp\"
fireDisplayEvents=\"true\" escape=\"true\" /--><!-- Added Temporarily
by ravindran on 8th jan 2001 -->\r\n");
com.iplanet.jato.taglib.TextFieldTag textField__7_1 =
(com.iplanet.jato.taglib.TextFieldTag)
JRunJSPStaticHelpers.createTagHandler(pageContext,
"com.iplanet.jato.taglib.TextFieldTag");
textField__7_1.setPageContext(pageContext);
textField__7_1.setParent(useViewBean__4_1);
textField__7_1.setSize("20");
textField__7_1.setMaxLength("20");
textField__7_1.setFireDisplayEvents("true");
textField__7_1.setName("tbUserID");
textField__7_1.doStartTag();
if(textField__7_1.doEndTag() == Tag.SKIP_PAGE) {
if(true) return;
out.print("\r\n<TITLE>pgHelp</TITLE>\r\n</HEAD>\r\n<body BGCOLOR=
\"white\" bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#0000FF\" vlink=
\"#800080\" alink=\"#FF0000\">\r\n");
com.iplanet.jato.taglib.FormTag form__11_1 =
(com.iplanet.jato.taglib.FormTag)JRunJSPStaticHelpers.createTagHandler
(pageContext, "com.iplanet.jato.taglib.FormTag");
form__11_1.setPageContext(pageContext);
form__11_1.setParent(useViewBean__4_1);
form__11_1.setMethod("post");
form__11_1.setName("pgHelp");
int form__11_1_startVal = form__11_1.doStartTag();
JRunJSPStaticHelpers.checkStartVal
("com.iplanet.jato.taglib.FormTag",form__11_1_startVal,BodyTag.EVAL_BO
DY_INCLUDE,11);
if(form__11_1_startVal == BodyTag.EVAL_BODY_INCLUDE) {
out.print("\r\n");
if(form__11_1.doEndTag() == Tag.SKIP_PAGE) {
if(true) return;
out.print("\r\n");
com.iplanet.jato.taglib.UseContainerViewTag view__1_1 =
(com.iplanet.jato.taglib.UseContainerViewTag)
JRunJSPStaticHelpers.createTagHandler(pageContext,
"com.iplanet.jato.taglib.UseContainerViewTag");
view__1_1.setPageContext(pageContext);
view__1_1.setParent(null);
view__1_1.setName("IPP.ipp.pgFooterViewBean");
int view__1_1_startVal = view__1_1.doStartTag();
JRunJSPStaticHelpers.checkStartVal
("com.iplanet.jato.taglib.UseContainerViewTag",view__1_1_startVal,Body
Tag.EVAL_BODY_INCLUDE,1);
if(view__1_1_startVal == BodyTag.EVAL_BODY_INCLUDE) {
currentView = (com.iplanet.jato.view.ContainerView)
pageContext.getAttribute("currentView");
currentTiledView = (com.iplanet.jato.view.TiledView)
pageContext.getAttribute("currentTiledView");
com.iplanet.jato.view.ContainerView
IPP.ipp.pgFooterViewBean = (com.iplanet.jato.view.ContainerView)
pageContext.getAttribute("IPP.ipp.pgFooterViewBean");
out.print("\r\n<hr color=red size=2>\r\nfrom new_footer.jsp in
IPP/ipp directory\r\n<font size=\"-2\" face=\"Arial\"><i>Send
comments to <a href=\"mailto:supportdept@a...\">Any
Company</a></i></font>\r\n<hr color=red size=2>\r\n");
com.iplanet.jato.taglib.HiddenTag hidden__6_1 =
(com.iplanet.jato.taglib.HiddenTag)
JRunJSPStaticHelpers.createTagHandler(pageContext,
"com.iplanet.jato.taglib.HiddenTag");
hidden__6_1.setPageContext(pageContext);
hidden__6_1.setParent(view__1_1);
hidden__6_1.setFireDisplayEvents("true");
hidden__6_1.setName("hdFooter");
hidden__6_1.doStartTag();
if(hidden__6_1.doEndTag() == Tag.SKIP_PAGE) {
if(true) return;
out.print("\r\n");
if(view__1_1.doEndTag() == Tag.SKIP_PAGE) {
if(true) return;
out.print("\r\n");
out.print("\r\n</BODY> \r\n</HTML>\r\n");
if(useViewBean__4_1.doEndTag() == Tag.SKIP_PAGE) {
if(true) return;
} catch(Throwable t) {
if(t instanceof ServletException)
throw (ServletException) t;
if(t instanceof java.io.IOException)
throw (java.io.IOException) t;
if(t instanceof RuntimeException)
throw (RuntimeException) t;
throw JRunJSPStaticHelpers.handleException(t,
pageContext);
} finally {
__jspFactory.releasePageContext(pageContext);
public String getServletInfo()
return "pgHelp";
private static final String[] __dependencies__ =
{"/IPP/ipp/pgHelp.jsp",null};
private static final long[] __times__ = {979720473658L,0L};
public String[] __getDependencies()
return __dependencies__;
public long[] __getLastModifiedTimes()
return __times__;
public int __getTranslationVersion()
return 14;
it is generating 2 semicolons automatically..
near pageContext.getAttribute("IPP.ipp.pgFooterViewBean");
regards
ravi
In [email protected], "Mike Frisino" <Michael.Frisino@S...>
wrote:
Hi Suket,
I just retested something very similar to this in 1.0.
Essentially, i took an existing page which included a tiledView.
I moved the TiledView jsp block into an entirely separate jsp file.
I then replace the TiledView jsp block in the original jsp with aninclude
<%@ include file="TiledGetOrders.jsp"%>
It worked like a charm.
So I am not sure what is wrong in your case.
Could be a jrun bug?
I have tested in resin 1.2.1
To do proper analysis, we would need to see
1. The intermediary .java file that the jsp engine creates, andthen tries
to compile.
C:/Program
Files/Allaire/JRun/servers/default/ipp/WEB-INF/jsp/jrun__IPP__ipp__pgHelp2ej
sp.java
Can you send that to us?
Incidentally, although we do not think a problem there would causethe
compile time error you are seeing,
i am curious about your file value.
<%@ include file="/IPP/ipp/pgFooter.jsp"%>I did not need to use a qualified file name, although my includetarget file
was in the same directory as the
page that was including it. What is the file system relationshipbetween
your top level page "pgHelp" and the include
target "pgFooter".
Are they in same or diff directories?
----- Original Message -----
From: <suket@u...>
Sent: Tuesday, January 16, 2001 9:42 PM
Subject: [iPlanet-JATO] Re: include jsp tags
Hi,
We tried to follow the steps described by you to have
dynamic include in a jsp page.
my jsp file content is
<%@p... info="pgHelp" language="java"%>
<%@t... uri="/WEB-INF/jato.tld" prefix="jato"%>
<jsp:useBean id="viewBean" class="IPP.ipp.pgHelpViewBean"
scope="request"></jsp:useBean>
<jato:useViewBean className="IPP.ipp.pgHelpViewBean">
<HTML>
<HEAD>
<jato:textField name="tbUserID" size="20" maxLength="20"
fireDisplayEvents="true" />
<TITLE>pgHelp</TITLE>
</HEAD>
<body BGCOLOR="white" bgcolor="#FFFFFF" text="#000000"
link="#0000FF" vlink="#800080" alink="#FF0000">
<jato:form name="pgHelp" method="post">
</jato:form>
<%@ include file="/IPP/ipp/pgFooter.jsp"%>
</BODY>
</HTML>
</jato:useViewBean>
This is my pgFooter.jsp
<jato:view name="IPP.ipp.pgFooterViewBean">
<hr color=red size=2>
from new_footer.jsp in IPP/ipp directory
<font size="-2" face="Arial"><i>Send comments to <a
href="mailto:<a href="/group/SunONE-JATO/post?protectID=061075104115193209050223163176249165134048139046">supportdept@a...</a>">Any Company</a></i></font>
<hr color=red size=2>
<jato:hidden name="hdFooter" fireDisplayEvents="true" />
</jato:view>
There is no compilation error in pgFooterViewBean and in
pgHelpViewBean.
How ever iam getting a runtime error,
500 Internal Server Error
/ipp/servlet/IPP.ipp.ippServlet:
javax.servlet.ServletException: Compilation error occured:
allaire.jrun.scripting.DefaultCFE:
Errors reported by compiler:C:/Program
Files/Allaire/JRun/servers/default/ipp/WEB-
INF/jsp/jrun__IPP__ipp__pgHelp2ejsp13.java:105:50:105:50: Syntax:
expected instead of this token
What could be the reason for this error message?
We tried the same thing with another approach, instead of using
include directive, we directly copied the code of pgFooter.jsp in
pghelp.jsp.
even that is giving the same error..
<%@p... info="pgHelp" language="java"%>
<%@t... uri="/WEB-INF/jato.tld" prefix="jato"%>
<jsp:useBean id="viewBean" class="IPP.ipp.pgHelpViewBean"
scope="request"></jsp:useBean>
<jato:useViewBean className="IPP.ipp.pgHelpViewBean">
<HTML>
<HEAD>
<jato:textField name="tbUserID" size="20" maxLength="20"
fireDisplayEvents="true" />
<TITLE>pgHelp</TITLE>
</HEAD>
<body BGCOLOR="white" bgcolor="#FFFFFF" text="#000000"
link="#0000FF" vlink="#800080" alink="#FF0000">
<jato:form name="pgHelp" method="post">
</jato:form>
<jato:view name="IPP.ipp.pgFooterViewBean">
<hr color=red size=2>
from new_footer.jsp in IPP/ipp directory
<font size="-2" face="Arial"><i>Send comments to <a
href="mailto:<a href="/group/SunONE-JATO/post?protectID=061075104115193209050223163176249165134048139046">supportdept@a...</a>">Any Company</a></i></font>
<hr color=red size=2>
<jato:hidden name="hdFooter" fireDisplayEvents="true" />
</jato:view>
</BODY>
</HTML>
</jato:useViewBean>
Please give us a feasible solution to solve this problem.
Thx
Ravi
--- In [email protected], "Todd Fast" <Todd.Fast@S...>wrote:
Craig & Eric--
(If you're not interested in the resolution to the problem Craigposted,
please skip ahead to the section in which I describe the
preferred
technique
for including headers and other common content in a JATO page.
This
discussion is very important because I introduce the concept of"view
compostion", in which JATO pages are composed of modular andreusable view
components. This is one of the most powerful new features of
JATO,
and a
capability that simply wasn't possible in NetDynamics.)
Posted Problem Resolution
Craig & Eric, from what I can tell, you are both trying to
include
a full
view bean in a parent page at translation time. This is notpossible, as
you can see from the compiler errors you get. There are
collisions
when
multiple top-level tags are included in the same JSP.
When I said earlier that you needed to use a translation-timeinclude
instead of a run-time include, I was assuming that you were
trying
to
include a fragment of HTML/JSP in the parent page. By
fragment, I
mean HTML
or JSP content that does not declare a view bean or form, but
rather
references views contained within the parent view bean. If youwant to
include a full page (JSP + ViewBean) in another page, then you'dneed to use
a run-time include. A run-time include temporarily pauses therendering of
the current page, and sends the full request to the included
page
as if it
were a separate client request. The resulting content from theincluded
page is inlined into the parent page's content, and processing
of
the parent
page then continues.
Now I realize after thinking about it a bit that we may not have
sufficiently provided for full page includes because of some
late-
breaking
changes in the request context handling. After some basic
testing,
it
appears that if you try to include one JATO page in another byreferencing
the JSP, the included page will cause a class cast exception tooccur.
There may also be problems because the request context on theincluded page
will not have been set. In any case, full JATO page inclusionlooks like
it's an issue we're going to have to address with some fixes
before
it will
work properly. My apologies. (One workaround if this is
necessary
is to
make the included view bean a child view of the parent view
bean.
I won't
go into that however).
How to Include Common Content
Now, on to the discussion of the preferred way of including
common
content
in a JATO page. Let's say you have a common header you want toinclude in
one or more of your JATO pages. Because of the issue I notedabove, and the
fact that the header is not really independently displayable,
you
don't want
to do a run-time include (which, remember, would necessitateincluding a
full JATO page).
Instead, you should include the header as an HTML/JSP fragmentusing a
translation-time include. Depending on whether your header hasdynamic
information, you can do one of two things. If the header is
just
static
content and/or set of links, you can just reference the HTMLfragment in the
parent HTML directly, and you won't need any kind of view or
view
bean to
back it, or any reference to anything in JATO.
If you need some dynamic info in the header, like the module URLfor a link,
you can reference the parent page's view bean for this
information
by simply
including references to the parent page's implicit JSP variables(viewBean,
currentVIew, and currentTiledView). For example:
Parent JSP:
<jsp:useBean id="viewBean" class="..."scope="request"></jsp:useBean>
<jato:useViewBean className="..." fireChildDisplayEvents="true">
<%@ include file="MyInclude.jsp" %>
</jato:useViewBean>
Included content (MyInclude.jsp):
... viewBean.getRequestContext().getModuleURL() ...
The final HTML with the included content would then look like
this:
<jsp:useBean id="viewBean" class="..."scope="request"></jsp:useBean>
<jato:useViewBean className="..." fireChildDisplayEvents="true">
... viewBean.getRequestContext().getModuleURL() ...
</jato:useViewBean>
MyInclude.jsp will be inlined in the parent JSP before it istranslated to a
servlet. Note that it does not include the full HTML tags
normally
found in
an HTML file--there are no <html>, <head>, or <body> tags
because
it is not
expected to be used outside of an include page. In effect,
this is
the
equivalent of a server-side include (SSI).
Now, if you need truly dynamic info in the header, like say youwant to
display the user's name and SSN, then you'd likely want to
embed a
child
view in the parent view bean which will encapsulate & provide
the
necessary
information. This is in contrast to actually making these
fields
direct
children of the the parent view bean, which would be a tedious
and
error
prone task on every page you wanted to include this information.Let me try
to contrast these two approaches with a diagram of parent-child
relationships:
Here's the bad way:
ParentViewBean (ViewBean)
|
+-- UserFirstName (StaticTextField)
|
+-- UserSSN (StaticTextField)
In this situation, you'd need to provide the logic to populatethese fields
in every view bean on which they appeared. This is tedious andessentially
eliminates the "common"-ness of the content (this is also whatNetDynamics
forced people to do).
Now, the better way:
ParentViewBean (ViewBean)
|
+-- MyHeaderView (MyHeaderView.java)
|
+-- UserFirstName (StaticTextField)
|
+-- UserSSN (StaticTextField)
In the better way, you can see that the header information isencapsulated
in an instance of "MyHeaderView", which is a subclass ofContainerViewBase
or one of the other ContainerView subtypes. The population of
the
data
fields is encapsulated in that view, and the parent view need
not
know
anything about what's actually being displayed by that view.
Thus, you can see that MyHeaderView, in conjunction with a
snippet
of JSP
content in a companion file, is completely modular and can beembedded in
any parent view bean on which you want the header to appear.
The
only
requirement is then to include MyHeaderView as a child view of
the
parent
view bean, and to include the correct JSP content that
references
that child
view.
The included JSP content would now look something like this:
<jato:view name="MyHeaderView">
<table>
<tr><td>... <jato:staticText name="UserFirstName"/>
...</td></tr>
<tr><td>... <jato:staticText name="UserSSN"/> ...</td></tr>
</table>
</jato:view>
If we now included this content in the parent JSP from furtherabove, we get
the following as the JSP content before it is translated into aservlet:
<jsp:useBean id="viewBean" class="..."scope="request"></jsp:useBean>
<jato:useViewBean className="..." fireChildDisplayEvents="true">
<jato:view name="MyHeaderView">
<table>
<tr><td>... <jato:staticText name="UserFirstName"/>
...</td></tr>
<tr><td>... <jato:staticText name="UserSSN"/> ...</td></tr>
</table>
</jato:view>
</jato:useViewBean>
Ultimately, this technique is called "view compostion" or "view
aggregation", and is one of the major new features of JATO. Youcan now
define reusable view components and embed them in multiple viewcontainers,
on the same page or on different pages. Each page acts as a
frame,
in which
you provide the contents from modular components. Using thistechnique, you
can develop reusable view classes and chunks of JSP that can bearbitrarily
combined into complex pages.
I know this is a long and rambling discussion, but I hope I've
made
myself
at least partly clear. I'm more than happy to clarify anything
or
elaborate
more. Please let me know.
Todd
Todd Fast
Senior Engineer
Sun/Netscape Alliance
todd.fast@e...
[email protected]
[email protected] -
Questions/answers from jsp to java bean
Hi
This is what i need to do .
I am showing some questions, say 4 of them , and radio buttons(yes/no) as answers in the JSP.
Now how do i transfer these questions and their answers from jsp to java bean .
I did try hashmap ,but not quite working .
any help?
thanksName each radiobutton differently, and then provide 1 property and accessor methods for each of your four answers in the JavaBean, with the same name as specified in the HTML FORM.
So in the HTML:
<input type="radio" name="answerOne" value="true"...>
and then have a property named answerOne with accessor methods in the javaBean... -
Problems in developing custom JSP tags
I have problems in debugging custom JSP tags. Sometimes the doStartTag is not called on tags but the doEndTag is called. I don't know why.
Thanks.Fahr--
A word of caution -- NetUI did not ship a JSP tag SDK in 8.x, and
we're making no compatibility guarantees for custom JSP tags written on
the 8.x release and future releases.
You can accomplish the same sort of functionality with a combination
of the <netui-data:getData> tag and JSTL 1.0. This solution would
probably provide similar functionality and be more future-proof relative
to JSTL and the NetUI tags currently being developed in Beehive.
Hope that helps.
Eddie
Fahr Vegnugen wrote:
We are in the midst of creating our own JSP tags to work with datasources.
In an example where you would need to compare two different datasources how would you do this?
ie.
<prefix:isGreater dataSource="{pageflow.column1}" dataSourceToCompare="{pageFlow.column2}" />
How would I evaluate what column2 is since the tag will only resolve one data source
this.evaluateDataSource();
Any pointers you can provide would be appreciated, or if there is a library of jsp tags that evaluate objects using datasources already created, that would even be better. -
Problem with boolean attribute of JSP tag
Hi,
I've being trying to use a custom JSP tag, which has a boolean attribute, declared in the TLD as follows:
<attribute>
<name>checked</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>boolean</type>
</attribute>
The JSP code snippet is:
<ui:check checked="<%= myBean.isChecked() %>"/>
where myBean.isChecked() returns a boolean value (primitive type).
It works fine on some web containers, but it causes a JSP compilation error on Oracle9iAS 9.0.3 Java Edition, which looks like the following:
Method toBoolean(boolean) not found in class test. _jsp_taghandler_57.setChecked( OracleJspRuntime.toBooleanObject( toBoolean( myBean.isChecked())));
After decompiling the container's JSP parser, I found what I think it's a bug. The java class generated by the JSP parser does not define a toBoolean method, and neither do its superclasses. The method is defined on the OracleJspRuntime class! I think the correct code would have to be something like:
OracleJspRuntime.toBooleanObject(OracleJspRuntime.toBoolean(...))
If I'm correct, then the "convertExpression" method of the "oracle.jsp.parse.JspUtils" class must be changed, because it outputs such wrong code for not just boolean types, but for all the primitive types.
So, has anyone ever faced this problem before? Does it have a workaround, or a patch? Is it included on the bug fixes for the 9.0.4 release?
Thanks!Instead of:
out.println("<body onload ="+strAlert+">");
Try this:
out.println("<body onload =\""+strAlert+\"">");
Add two \" around the alert call. -
Sp9 / pre-release / problem with jsp tags
WLS 5.1, sp9 pre-release, solaris 2.7, WLCS 3.2
JSP compile fails with the exception...
weblogic.servlet.jsp.JspException: (line -1): Error in tag library
at: 'wl':
The Tag class 'weblogicx.jsp.tags.CacheTag' has no setter method
corresponding to
TLD declared attribute 'async', (JSP 1.1 spec, 5.4.1)
at weblogic.servlet.jsp.StandardTagLib.jspException(StandardTagLib.java:138)
at weblogic.servlet.jsp.StandardTagLib.processTag(StandardTagLib.java:264)
at weblogic.servlet.jsp.StandardTagLib.processTagElements(StandardTagLib.java:146)
at weblogic.servlet.jsp.StandardTagLib.<init>(StandardTagLib.java:125)
at weblogic.servlet.jsp.JspLexer.loadTagLib(JspLexer.java:95)
at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE_BODY(JspLexer.java:3873)
at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE(JspLexer.java:3623)
at weblogic.servlet.jsp.JspLexer.mDIRECTIVE(JspLexer.java:3484)
at weblogic.servlet.jsp.JspLexer.mSTANDARD_THING(JspLexer.java:1817)
at weblogic.servlet.jsp.JspLexer.mTOKEN(JspLexer.java:1658)
at weblogic.servlet.jsp.JspLexer.nextToken(JspLexer.java:1548)
at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java:888)
at weblogic.servlet.jsp.JspParser.doit(JspParser.java:69)
at weblogic.servlet.jsp.JspParser.parse(JspParser.java:125)
at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:109)
at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:242
It could just be me - I an un-jarred a version of weblogic-tags-510.jar where WLS
could find it.
mike
Kumar Allamraju <[email protected]> wrote:
>Yes, my JSP is referring the tag libs. I 'm using counter example given
>in
>examples/jsp/tagext/counter directory
>
><NT Performance Pack> NATIVE: created IoCompletionPort successfully.
>I
>oPort=0x000001d4
>Sun Apr 01 12:44:00 PDT 2001:<I> <WebLogicServer> WebLogic Server star
>ted
>Sun Apr 01 12:44:40 PDT 2001:<I> <NT Performance Pack> Allocating: '2'
> NT reader threads
>Sun Apr 01 12:44:41 PDT 2001:<I> <ServletContext-General> *.jsp: init
>Sun Apr 01 12:44:41 PDT 2001:<I> <ServletContext-General> *.jsp: param
> verbose initialized to: true
>Sun Apr 01 12:44:41 PDT 2001:<I> <ServletContext-General> *.jsp: param
> packagePrefix initialized to: jsp_servlet
>Sun Apr 01 12:44:41 PDT 2001:<I> <ServletContext-General> *.jsp: param
> compileCommand initialized to: c:/java/java122/bin/javac.exe
>Sun Apr 01 12:44:41 PDT 2001:<I> <ServletContext-General> *.jsp: param
> srcCompiler initialized to weblogic.jspc
>Sun Apr 01 12:44:41 PDT 2001:<I> <ServletContext-General> *.jsp: param
> superclass initialized to null
>Sun Apr 01 12:44:41 PDT 2001:<I> <ServletContext-General> *.jsp: param
> workingDir initialized to: D:\releases\510\myserver\classfiles
>Sun Apr 01 12:44:41 PDT 2001:<I> <ServletContext-General> *.jsp: param
> pageCheckSeconds initialized to: 1
>Sun Apr 01 12:44:41 PDT 2001:<I> <ServletContext-General> *.jsp: Using
> Encoding : ISO-8859-1 when constructing PrintWriter instead of Servle
>tOutputStream
>Sun Apr 01 12:44:41 PDT 2001:<I> <ServletContext-General> *.jsp: initi
>alization complete
>Sun Apr 01 12:44:42 PDT 2001:<I> <ServletContext-General> looking for
>taglib uri /counter.tld as resource /WEB-INF/counter.tld in Web Applic
>ation root:
>Sun Apr 01 12:44:43 PDT 2001:<I> <ServletContext-General> Generated ja
>va file: D:\releases\510\myserver\classfiles\jsp_servlet\_pagehits.jav
>a
>Sun Apr 01 12:44:45 PDT 2001:<I> <ServletContext-General> file: init
>
>
>what's the change number you get from weblogic.Admin VERSION?
>
>
>--
>Kumar
>
>Mike Reiche wrote:
>
>> From the zip file.
>>
>> It has to be a jsp that references those tag libraries.
>> Other than that it works like a charm.
>>
>> Mike
>>
>> Kumar Allamraju <[email protected]> wrote:
>> >Did you extracted the SP9 zip or exe?
>> >I do not see the following errors when accessing a jsp with SP9? Could
>> >you tell us how to
>> >reproduce it?
>> >
>> >BTW, i will ask our docs folks to correct the startup scripts..
>> >
>> >--
>> >Kumar
>> >
>> >Mike Reiche wrote:
>> >
>> >> I had to remove the 'async' attribute from taglib.tld
>> >>
>> >> And when I use WLCS I have to remove it from weblogic.tld
>> >>
>> >> And the startup scripts provided do not include weblogic-tags-510.jar
>> >> in the classpath.
>> >>
>> >> Mike
>> >>
>> >> "Mike Reiche" <[email protected]> wrote:
>> >> >
>> >> >WLS 5.1, sp9 pre-release, solaris 2.7, WLCS 3.2
>> >> >
>> >> >JSP compile fails with the exception...
>> >> >
>> >> >weblogic.servlet.jsp.JspException: (line -1): Error in
>> >> >tag library
>> >> >at: 'wl':
>> >> >The Tag class 'weblogicx.jsp.tags.CacheTag' has no setter
>> >> >method
>> >> > corresponding to
>> >> >TLD declared attribute 'async', (JSP 1.1 spec, 5.4.1)
>> >> > at weblogic.servlet.jsp.StandardTagLib.jspException(StandardTagLib.java:138)
>> >> > at weblogic.servlet.jsp.StandardTagLib.processTag(StandardTagLib.java:264)
>> >> > at weblogic.servlet.jsp.StandardTagLib.processTagElements(StandardTagLib.java:146)
>> >> > at weblogic.servlet.jsp.StandardTagLib.<init>(StandardTagLib.java:125)
>> >> > at weblogic.servlet.jsp.JspLexer.loadTagLib(JspLexer.java:95)
>> >> > at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE_BODY(JspLexer.java:3873)
>> >> > at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE(JspLexer.java:3623)
>> >> > at weblogic.servlet.jsp.JspLexer.mDIRECTIVE(JspLexer.java:3484)
>> >> > at weblogic.servlet.jsp.JspLexer.mSTANDARD_THING(JspLexer.java:1817)
>> >> > at weblogic.servlet.jsp.JspLexer.mTOKEN(JspLexer.java:1658)
>> >> > at weblogic.servlet.jsp.JspLexer.nextToken(JspLexer.java:1548)
>> >> > at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java:888)
>> >> > at weblogic.servlet.jsp.JspParser.doit(JspParser.java:69)
>> >> > at weblogic.servlet.jsp.JspParser.parse(JspParser.java:125)
>> >> > at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:109)
>> >> > at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:242
>> >
>
-
JSP tags for managing MBeans??
Hi,
I'm trying to build a GUI for managing a custom MBean. The MBean implementation is a wrapper for a singleton class (specifically, a Configuration class for a web app). I've tried using WebJMX, but the problem there is that it relies heavily on MX4J, and has not kept up with JMX advances in the last two years (MX4J is a bit ahead of weblogic 8.1).
Just as there is a set of console extension jsp tags, I suspect that a set of JSP tags exists for the developers of the Weblogic console to write their JSP pages to manage the weblogic MBeans. I coud just try to figure out the pattern of the INPUT and FORM tags in the html, but that leaves me with a possibly-inaccurate, version-dependent, non-dynamically-generated page to manage one MBean.
Does such a set exist? Could someone point me to any information about how to use such a set of tags?
I would like to be able to have the JSP I use for my console extension display an interface for modifying MBean configurable fields and executing MBean operations. What would the best way be to do this? I do not want to embed the Sun JMX RI in my web-app and launch a separate HtmlAdaptor listening on a different port. I would like the admin to the MBean be accessible through (and only through) the weblogic console.
Thanks in advance for the help,
Matt GeisHi,
I'm trying to build a GUI for managing a custom MBean. The MBean implementation is a wrapper for a singleton class (specifically, a Configuration class for a web app). I've tried using WebJMX, but the problem there is that it relies heavily on MX4J, and has not kept up with JMX advances in the last two years (MX4J is a bit ahead of weblogic 8.1).
Just as there is a set of console extension jsp tags, I suspect that a set of JSP tags exists for the developers of the Weblogic console to write their JSP pages to manage the weblogic MBeans. I coud just try to figure out the pattern of the INPUT and FORM tags in the html, but that leaves me with a possibly-inaccurate, version-dependent, non-dynamically-generated page to manage one MBean.
Does such a set exist? Could someone point me to any information about how to use such a set of tags?
I would like to be able to have the JSP I use for my console extension display an interface for modifying MBean configurable fields and executing MBean operations. What would the best way be to do this? I do not want to embed the Sun JMX RI in my web-app and launch a separate HtmlAdaptor listening on a different port. I would like the admin to the MBean be accessible through (and only through) the weblogic console.
Thanks in advance for the help,
Matt Geis -
Jsp tag for blog attribute in a flex asset
hi Experts,
I am using FW7.6.1, I have a flex asset with a blob attribute, when I create that flex asset, I can upload an image in that attribute, but I did not find a jsp tag for rendering that attribute which has a image saved, another question is what jsp tag should be used in case of a word file is uploaded in that attribute, that's to say:
1. for a image, I want to display it in browser.
2. for a word file, I want to show popup window to ask user if he wants to download or open.
By using assetset:getattributevalues and render:stream, it's just for string type of attribute, not for blog.
Thanks in advance.
Best regardshi all,
I got the answer from dev guide, seems should use:
<blobservice:gettablename varname="uTabname"/>
<blobservice:getidcolumn varname="idColumn"/>
<blobservice:geturlcolumn varname="uColumn"/>
and render:satelliteblob
some complicated then I expected.
Best regards -
We are researching JSP Tags as a method of seperating our creative and coding efforts. Our research is showing that JSP tags is a resource hog and noticed that none of the JSP Tags are being pooled. Docs that we have looked at suggest that pooling does occur, but we do not see it happening. Is anyone using this technology and if so how is the performance?
Cameron,
In general, what kind of "interesting bugs" and "design flaws" do you mean?
I would expect that using any kind of cache can allow for bugs due to developers
confusion... but are there inherent "bugs" (or design flaws) that are built into
WL's Cache tag?
Jack Lin
Cameron Purdy wrote:
> Install the latest SP. They are (relatively speaking) resource intensive.
> However, properly implemented/used, this relative cost is close to 0.
> (Instantiating a Java class and calling a few empty methods uses a couple
> hundred clock cycles on a good JVM.) BTW Pooling is considerably more
> expensive for simple objects than instantiating new ones. Also, due to
> design flaws in the custom tag API, pooling JSP tags could lead to some
> interesting bugs related to the lack of re-initialization.
>
> --
>
> Cameron Purdy
> [email protected]
> http://www.tangosol.com
> WebLogic Consulting Available
>
> "Anthony Raiti" <[email protected]> wrote in message
> news:39d4a35f$[email protected]..
> We are researching JSP Tags as a method of seperating our creative and
> coding efforts. Our research is showing that JSP tags is a resource hog and
> noticed that none of the JSP Tags are being pooled. Docs that we have looked
> at suggest that pooling does occur, but we do not see it happening. Is
> anyone using this technology and if so how is the performance?
Maybe you are looking for
-
Functional specs and technical specs
Hello friends can any one send me some functional specs and technical specs to my email id [email protected] shankar thanks for ur help please send me some documents to my email id.
-
OY04 setting currency maintaining (Decimal Places for currency codes) Importance
Hello Frds, I have one doubt regarding OY04 setting in this we are maintaining currencies with decimals.I checked my OY04 setting some special currencies only we are maintaining in this tcode and in that also some currencies only maintaining decimal
-
Req for FM for adding some days to sy-date
Hi experts, my requirement is I have some 'X' number of days to finish my work. And I need to add these number of working days (let me say 10 days )to the system date. sy-date + 10 gives me the weekend days also. so I need to skip the weekend d
-
Populate variables from int table
Hello There is internal table with fields VNAM , VALUE VAR1 100 VAR2 200 VARn
-
Hi Gurus, I installed BI nw2004s in windows environment(With MaxDB) with 4GB ram and 2X2.61 GHz processor we completed installation successfully. After that we restared the server and we got problem with disp+work.EXE that is stopped. while checking