Dynamic select using jsp?
grrrrr............ok so I'm kinda new to this, and just a little frustrated. I'm gonna ramble here, so any time I sound like I don't know what I'm talking about it 's because I don't..correct me. I want to include a bean in a jsp which will buil d a dynamic select box on the fly. That is, connect to an LDAP db and place each value returned in the query in a select box. Now, I can compile and run the bean in my IDE and watch the output in the console. It's correct because I see "<select><option value = hall>hall....</select>". In the buildSelectBox() method I'm using System.out.println to display each line of my select box (is that right?). Now, when I copy the .class file over to the server I was initially getting an error because the bean wasn't found. I resolved that by properly compiling the bean in a package. Problem is that if I call the bean.buildSelect() method in the .jsp nothing comes back. The page is left blank. What in the world is that about? Can someone push me toward a tutorial that can push me in the right direction or sumthin? Why am I having so much trouble with this? Should I be building the select on the jsp?
regards,
mat
Hi!
If i understand you correctly :-) you are doing not very right things. I don't want it to seem like I'm going to teach you, but:
The Bean that has buildSelect() method is not a bean at all. Usualy Beans contain getter/setters and accumulate data. If you want to build html code dynamicaly then you should use servlets(Which is not very flexible in your situation, I think), not JSPs. And if you are using JSPs then you have to make Tag which will do this everything.
Other way is to use Struts framework which is very good and flexible for building web applications - it has it's own tags for many cases. You can make loops in JSPs, use beans and all that stuff.
Guys will correct me if I missed something.
Good luck
Similar Messages
-
How to create two level dynamic list using JSP , Java Script and Oracle
I am new in JSP. And i am facing problem in creating two level dynamic list using JSP ,Java Script where the listdata will come from Oracle 10g express edition database. Is there any easy way in JSP that is available on in ASP.NET.
Plz response with details.1) Learn JDBC API [http://java.sun.com/docs/books/tutorial/jdbc/index.html].
2) Create DAO class which contains JDBC code and do all SQL queries and returns or takes ID's or DTO objects.
3) Learn Servlet API [http://java.sun.com/javaee/5/docs/tutorial/doc/].
4) Create Servlet class which calls the DAO class, gets the list of DTO's as result, puts it as a request attribute and forwards the request to a JSP page.
5) Learn JSP and JSTL [http://java.sun.com/javaee/5/docs/tutorial/doc/]. Also learn HTML if you even don't know it.
6) Create JSP page which uses the JSTL c:forEach tag to access the list of DTO's and iterate over it and prints a HTML list out.
You don't need Javascript for this. -
Error on a Dynamic Select using Pro*C
I am a new user on Pro*C and I am facing an error for which I could not find a solution in the Pro*C/C++ Programmer’s Guide. The problem occurs when I do a dynamic SELECT to retrieve sequence of numbers (from 0 to 10) from a very simple table in a database.
The program is retrieving the following sequence: {705, 961, 1217, 1473, 1729, 1985, 2241, 2497, 2753, 3009} rather than the sequence {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}.
It’s very interesting to notice that the retrieved sequence, in hexadecimal, is equal to {2C1, 3C1, 4C1, 5C1, 6C1, 7C1, 8C1, 9C1, AC1, BC1}.
I am quite sure that I'm missing a small detailed here and I would appreciate
any help. Please find below the code that I am using.
Thanks a lot!
#include <string>
#include <iostream>
using namespace std;
#include <sqlca.h>
#include <sqlcpr.h>
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR username[30];
VARCHAR password[30];
VARCHAR db_name [30];
VARCHAR dns_name[30];
EXEC SQL END DECLARE SECTION;
void SQL_Error ( void )
char msg[200];
size_t buf_len = sizeof ( msg );
size_t msg_len;
sqlglm( msg, &buf_len, &msg_len );
if ( msg_len > buf_len )
msg_len = buf_len;
cout << msg << endl;
bool OpenDBConnection( char uname, char pword, char dns, char dbname )
// Assign the database identifications to the ORACLE variables
username.len = (unsigned short) strlen ( strcpy( (char *) username.arr, uname ) );
password.len = (unsigned short) strlen ( strcpy( (char *) password.arr, pword ) );
dns_name.len = (unsigned short) strlen ( strcpy( (char *) dns_name.arr, dns ) );
db_name.len = (unsigned short) strlen ( strcpy( (char *) db_name.arr , dbname ) );
/* Register sql_error() as the error handler */
EXEC SQL WHENEVER SQLERROR goto err;
/* Connect to the non default database */
EXEC SQL CONNECT :username IDENTIFIED BY :password AT :db_name USING :dns_name;
return ( true );
err:
SQL_Error();
return ( false );
** Select the database using a dynamic method
long SelectIDRecord ( void )
EXEC SQL BEGIN DECLARE SECTION;
// Define the dynamic statement
char dyn_statement[4000];
// Define the bind variables
long db_id = 0;
long db_id_type = 2; /* NUMBER */
long db_id_len = 10;
EXEC SQL END DECLARE SECTION;
// Initialize the dynamic statement
memset ( dyn_statement, 0, sizeof( dyn_statement ) );
strcpy ( dyn_statement, "SELECT ID FROM TEST_DB ORDER BY ID" );
EXEC SQL AT :db_name PREPARE s1 FROM :dyn_statement;
// Declare and initialize the output descriptor
EXEC SQL ALLOCATE DESCRIPTOR 'out';
EXEC SQL AT :db_name DESCRIBE OUTPUT s1 USING DESCRIPTOR 'out';
EXEC SQL SET DESCRIPTOR 'out' value 1 TYPE = :db_id_type,
LENGTH = :db_id_len, DATA = :db_id;
// Declare and open the cursor
EXEC SQL AT :db_name DECLARE test_db_cursor CURSOR FOR s1;
EXEC SQL AT :db_name OPEN test_db_cursor;
EXEC SQL WHENEVER NOT FOUND DO BREAK;
long nRec = 0;
while ( true )
EXEC SQL AT :db_name FETCH test_db_cursor INTO DESCRIPTOR 'out';
EXEC SQL GET DESCRIPTOR 'out' VALUE 1 :db_id = DATA;
nRec++;
cout << "ID = " << (long) db_id << endl;
// Close the cursor
EXEC SQL AT :db_name CLOSE test_db_cursor;
EXEC SQL DEALLOCATE DESCRIPTOR 'out';
return ( nRec );
err:
SQL_Error();
return ( 0 );
int main ()
char *uname = "test";
char *pword = "test";
char *dns = "test_db";
char *dbname = "test";
OpenDBConnection ( uname, pword, dns, dbname );
long nRec = SelectIDRecord ();
}No need to specify the length if the data type is number and pointing to Long.
You can directly map the values using INTO clause. -
How to get a dynamic pages using jsp?
actually using jsp we create static pages.
My question is whether it is possible to create dynamic pages. ie the page should reflect changes without refreshing or reloading. for example we have date timings frequently updated without refreshingRead Beginning JSP from WROX Press. It is a good book for developing dynamic JSP using all latest technologies.
-
HI All,
This is very urgent for me please help me to come out of this.
I just want to display the values in combobox from database using jsp,but i have difficulty in doing it can any one help me for this.I will be thankfull if any one gives me a code for the same.
Ramesh.Rvery simple example
<%@ page import="java.sql.*" %>
Add Item:
<SELECT NAME="item">
<ol>
<%
Connection con5 =
DriverManager.getConnection("url","user","password");
String q5 = "query" ;
Statement stmt5 = (Statement)con5.createStatement();
ResultSet rs5 = stmt5.executeQuery(q5);
while(rs5.next()){
String str5= rs5.getString("field");
%>
<li> <% out.print("<OPTION>" + str5); %>
<% } %>
</ol>
</SELECT> -
Dynamic Selection using Summarization Fields Missing in TCODE CN43N
If Using TCODE CN43 I can select using Summarization Fiields from PSMERK via Dynamic Selections.
However, when I use TCODE CN43N the "Summarization Fields" node is not displayed.
Does anyone know if it is possible to activate this option for CN43N.Hi,
Please refer sap note 679705.
hope it will be helpful
thanks
abdul -
Hi,
I want to include two fields of custom infotype in dynamic selection of LDB so that they are handeled automatically by LDB while selection.
can anyone tell me how to achieve the same?
Thanks
-AleriaThankyou for the reply. However, can you plz tell me the step to followfor addition of fields after copying the LDB.
-Aleria -
Cancel- and main-button dynamically generated using JSP-pages
Maybe a HOWTO for the Jdev-team.
HOWTO get rid of the delete and main-button in your jsp-pages?
Very simple!
Go to the container_bottom.jsp page in your webapp/jsp-folder and delete the code for the cancel-button => now the user can render his own buttons by using a header.html, contents.jsp and footer.html for the jsp-pages.We tried the same thing you are trying to do and got
very far, but it quickly became very complicated. We
realized it was just simpler to use the screenflow as
intended.
By this I mean, if your parent form has 4 buttons
(A,B, C and SUBMIT), you should design different
paths in your screen flow for each button. so when a
user clicks button A, the parent form submits back to
Fuego engine, engine looks at screenflow and send
them down the button A path to the Form A. When they
hit submit on Form A, screenflow goes back to parent
form.Hi, bcespinola:
Our team finally decide use jsp with YUI (Yahoo User Interface Library) to achieve this design. Wish this could help you. All popup window would be replaced by Dialog of YUI. Thanks for your help.
Vince -
XMLDataSet and Dynamic XML using JSP
I am trying to use the XMLDataSet function to call a jsp page
instead of an xml file. The jsp page fetches records out of a db
and creates xml to return to the spry function. Nothing seems to be
returned, and blank spry data region on page.
If i supply a xml file to the function it works correctly.
I adapted the ASP/PHP samples from XMLExport demo. Code as
follows:- If i run 2nd jsp directly, the browser shows the xml as
expected.
--- TEST.JSP ---
<script type="text/javascript">
Spry.Data.Region.debug=true;
var dsPeople = new Spry.Data.XMLDataSet("transtoxml.jsp",
"company/person");
</script>
--- transtoxml.jsp ---
<%@ page language="java"
import="java.sql.*, java.io.*, java.util.*,
com.Ostermiller.util.*"
errorPage="" %>
<%@ include file="globals.jsp" %>
<%
String SQL="";
Statement sTransaction;
ResultSet rTransaction;
try
Class.forName(className);
con =
java.sql.DriverManager.getConnection(connectionURL,userName,password);
}catch(Exception e){
out.print(e.toString());
out.print("Error connecting to database " + connectionURL);
SQL ="SELECT ";
SQL+="[ID], ";
SQL+="[DocumentNo]";
SQL+="FROM TRX_TRANSACTION_MAPPING";
sTransaction = con.createStatement();
try {
rTransaction = sTransaction.executeQuery(SQL);
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("pragma","no-cache");
%>
<?xml version='1.0' encoding='iso-8859-1'?>
<company>
<% while(rTransaction.next()) { %>
<person>
<id><%=(rTransaction.getString("ID"))%></id>
</person>
<% } %>
</company>
<%
response.flushBuffer();
sTransaction.close();
} catch (SQLException e) {
out.print(e);
%>This is the xml output the jsp gives when run directly:- Cut
n pasted from browser. There does appear to be an error, because
the spry:state="error" div is being displayed. If i paste the
following into a file all is ok, any ideas anyone.
regards
sm@rt
<?xml version="1.0" encoding="iso-8859-1" ?>
- <company>
- <person>
<id>117</id>
</person>
- <person>
<id>118</id>
</person>
- <person>
<id>119</id>
</person>
- <person>
<id>120</id>
</person>
- <person>
<id>121</id>
</person>
- <person>
<id>122</id>
</person>
- <person>
<id>123</id>
</person>
- <person>
<id>124</id>
</person>
- <person>
<id>125</id>
</person>
- <person>
<id>126</id>
</person>
- <person>
<id>127</id>
</person>
- <person>
<id>128</id>
</person>
- <person>
<id>129</id>
</person>
- <person>
<id>130</id>
</person>
- <person>
<id>131</id>
</person>
- <person>
<id>132</id>
</person>
- <person>
<id>133</id>
</person>
- <person>
<id>134</id>
</person>
- <person>
<id>135</id>
</person>
- <person>
<id>136</id>
</person>
- <person>
<id>137</id>
</person>
- <person>
<id>138</id>
</person>
- <person>
<id>139</id>
</person>
- <person>
<id>141</id>
</person>
</company> -
How to build dynamic menus using JSP==Urgent==Please Help me
Hello,
I have exhausted searching on internet to find a book
which tells how to build Dynmic menus in JSP.I dont want
to use DHTML as this becomes complex as the menu categories
are built using data from database.Is there any workaround in
java to do this without DHTML or atleast sample code.
can somebody help me in this regard.
Thanks
JackHello a.s.kumar,
I would be greatful if you could send me the sample code.
[email protected]
we can't let MM Flash run away with the show can we. Javascript can do a decent job, but the underlying menu data is static.
Cheers, Darren -
Make a dynamic menu using JSP or Javascript
Hi ,
I am trying to make a dynamic menu that is using data retrieved from database in the form of a list.
I have a javascript to make a tree structure menu, but i need to iterate through the list i am reciveing from the database to make the tree structure. here is the code :-
<Please reply ASAP as my deadline is near>
<Note:- in javascript to make static menu ul tag is used to make the parent node and li tag is use to make the child node>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<SCRIPT LANGUAGE="JavaScript" SRC="mktree.js"></SCRIPT>
<LINK REL="stylesheet" HREF="mktree.css">
</head>
<body>
<%@ page import = "java.util.ArrayList, java.util.Iterator, java.util.List, \WEB-INF\classes\DO_JSP.class,
\WEB-INF\classes\Url_Name.class, java.util.Comparator, java.util.TreeSet, \WEB-INF\classes\MyComp.class" %>
<%
class Url_Name {
String linkName;
String linkUrl;
int order;
* @return the order
public int getOrder() {
return order;
* @param order the order to set
public void setOrder(int order) {
this.order = order;
* @return the linkName
public String getLinkName() {
return linkName;
* @param linkName the linkName to set
public void setLinkName(String linkName) {
this.linkName = linkName;
* @return the linkUrl
public String getLinkUrl() {
return linkUrl;
* @param linkUrl the linkUrl to set
public void setLinkUrl(String linkUrl) {
this.linkUrl = linkUrl;
class MyComp implements Comparator{
public int compare(Object a, Object b){
return (((Url_Name)a).getOrder() - ((Url_Name)b).getOrder());
class DO_JSP
int parentId;
String parentName;
TreeSet linkList;
Url_Name tempurl;
* @return the linkList
DO_JSP(){
linkList = new TreeSet(new MyComp());
public TreeSet getLinkList() {
return linkList;
* @param linkList the linkList to set
public void setLinkList(String linkName, String linkUrl, int order) {
tempurl = new Url_Name();
tempurl.setLinkName(linkName);
tempurl.setLinkUrl(linkUrl);
tempurl.setOrder(order);
this.linkList.add(tempurl);
* @return the parentName
public String getParentName() {
return parentName;
* @param parentName the parentName to set
public void setParentName(String parentName) {
this.parentName = parentName;
* @return the parentId
public int getParentId() {
return parentId;
* @param parentId the parentId to set
public void setParentId(int parentId) {
this.parentId = parentId;
%>
<%
List listdojsp =new ArrayList();
listdojsp = (List)session.getAttribute("JspListName");
Iterator it = listdojsp.iterator();
do
%>
<%
DO_JSP tempdojsp = (DO_JSP)it.next();
String Parent = tempdojsp.getParentName();
%>
<ul class="mktree">
<li> Parent </li>
<ul>
<%
Iterator ittemp = tempdojsp.getLinkList().iterator();
do
Url_Name tempurlname = new Url_Name();
tempurlname = (Url_Name)ittemp.next();
String link = tempurlname.getLinkName();
%>
<li>link</li>
<%
}while(ittemp.hasNext());
%>
</ul>
</ul>
<%
}while(it.hasNext());
%>
</body>
</html>Hi ,
I am trying to make a dynamic menu that is using data
retrieved from database in the form of a list.
I have a javascript to make a tree structure menu,
but i need to iterate through the list i am reciveing
from the database to make the tree structure. here is
the code :- Hi, do you have a question? This is more of a "Look what I wrote" sort of post, and you don't seem to be asking for any specific advice. Please tell us what problem you're having, or the error message you're receiving.
Brian -
Help: Creating a Dynamic TreeView Using JSP
I'm involved in a research project developing a webclient for the subversion VCS. I was able to access the repository and get the content as a string using the JavaSVN Library. It is like follows
A/
A/1.txt
A/B/2.txt
A/B/3.txt
C/
C/4.txt
The problem i'am having is that displaying this out put in a tree Type Structure. So any one can help me this any matter is greatly appriciated
Regards,
SamanthaJavascript open source for Tree Menu
http://www.softcomplex.com/products/tigra_tree_menu_pro/ -
Using jsp:include in showOneTab - main form not loaded on submit
I have a JSP page with JSF and ADF components. It is a large JSP containing some main details and then an af:showOneTab component to create a set of tabs. It works fine with JDK 1.5 and Tomcat 5.0 but when changed to Oracle Application Server 9.0.4 and JDK 1.3 We get the following error:
JspCompileException:.... code too large for try statement catch( Throwable e}....
Finding this to be caused by large size of JSP, we divided the page as follows - a main jsp containing the main form details and 1 jsp for each tab. Whenever one of the tabs is clicked the corresponding JSP is dynamically loaded using jsp:include tag as follows:
<af:showDetailItem text="Tab1" id="tab1" styleClass="menu">
<f:subview id="viewTab1">
<jsp:include page="Tab1.jsp" />
</f:subview>
</af:showDetailItem>
There is a Submit button in the main jsp, when this is clicked the main jsp is reloaded.
But when the user navigates to any of the tabs and then clicks the Submit button in the main form, the main form is not reloaded - only the jsp for the currently selected tab is loaded.
(I am using f:view and h:form in the main form, and no form tag in the included jsps)
How to solve this problem?The af:selectOneChoice components are in the test.jsp page included in main.jsp with jsp:include tag.
The code look like this:
<af:selectOneChoice label="#{msg.team}"
id="soc1"
value="#{myBean.selectedTeamID}"
autoSubmit="true">
<f:selectItems id="si1" value="#{myBean.teamList}"/>
</af:selectOneChoice>
<af:selectOneChoice label="#{msg.subteam}"
id="soc2"
value="#{myBean.selectedSubteamID}"
partialTriggers="soc1"
rendered="#{myBean.selectedTeamID!=null}"
autoSubmit="true">
<f:selectItems id="si2" value="#{myBean.subteamList}"/>
</af:selectOneChoice>
the code works fine in the seperate page, but when I include the page the second selectOneChoice component doesnt get rendered.
Edited by: Migan on 2010-jul-13 08:36 -
Dynamic selections with FBL1N transaction
Hello,
I want to add new fields to do dynamic selections using FBL1N transaction.
I have "House bank" field in the company code fields, but I want this field in the document fields.
How could I do it?
Thank you very muchDear Beatriz
Yes this is possible. You need to extend the selection view for the logical database KDF using transaction SE36, to have more selection fields available in the dynamic selections of the line item display.
Call up Transaction SE36 and enter the logical database KDF.
Choose "Extras --> Selection views".
Select the origin of view.
Choose "Display" or "Change".
Vendors: logical database: KDF
Permitted tables:
LFA1, LFB1: All fields are permitted that are contained in the VF_KRED
view. If necessary, you have to include additional fields in
the view fields category using Transaction SE11.
BSIK: all fields
Change the source code in program SAPDBKDF, Form INIT as explained in the SAP note 310886.
If this helps please reward with points.
Best Regards
Kesav -
Dynamic selection field display
Hi
Can we display field values for a field from Dynamic selection ?Hi,
Yes, you can display field values in dynamic selection field.
If I understood your question correctly, you are talking about the dynamic selection used in reports ( For eg. ME2N). The field which are appearing in dynamic selection shows the field values. ( you can press F4 and check the field values).
Rajesh.
Maybe you are looking for
-
HP envy m6-n113dx trackpad malfunctioning
I have a brand new m6-n113dx that has a useless trackpad. It constantly jerks around randomly, speeds up/slows down, twitches and otherwise has a mind of its own. So far, all tech support has failed to permanently fix the issue. This is what has be
-
FI-CA Open Items based on key date Business Content
Hi, I am using BI content infocube 0FC_C07 to extract contract account open items data. Our requirement is to do the data load weekly basis based on key date. I have enhanced the extractor and i can see data for the enhanced fields in RSA3. But now,
-
Solution to mapping a file with diferent content
Hi all, I have the next scenario: Source: XML file in a FTP server (this file have an unique name and can be diferent content, all contents are IDOC in XML format, for example ORDERS, INVOIC,...) Mapping: only transfer the XML IDOC to a R/3 system (a
-
Why can't I download Canon S100 CR2 RAW files into PSE 10?
I am using PSE 10 with a Canon S100 camera. I am successful in downloading all of my jpeg files and RAW CR2 files from my older Canon Rebel, but not with the Canon S100 CR2 Raw files. When first downloading from the Canon S100 camera into PSE 10 and
-
OBIEE Dashboard in iphone Business Indicators
Hi one of my customer want to access OBIEE reports and Dashboard through i phone device the integration has done with i phone and able to access the reports from shared folders by using Oracle Business Indicators But I am facing with the below issues