shan rast

Greenhorn
+ Follow
since Jan 25, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by shan rast

shan rast wrote:

Campbell Ritchie wrote:

shan rast wrote:Thanks i got it but i have new problem i have posted a new post please give a solutionn for that

Please tell us how you solved the problem, so others can learn from your experience.



Pattern p1 = Pattern.compile("&lt;h2[^&gt;]*&gt;&quot;+&quot;.*?<a >]*&gt;&quot;+&quot;([^&lt;]+)&quot;+&quot;&lt;/a[^&gt;]*&gt;&quot;);
this is the pattern and now you just need to call the second group which will give the names of the author



i have parsed the data and now i need to store it in .xml or say it as to write in xml
so thats my second problem i coded for that but its not working please can you give me some link where i can get some tutorial i need it urgent
13 years ago

Campbell Ritchie wrote:

shan rast wrote:Thanks i got it but i have new problem i have posted a new post please give a solutionn for that

Please tell us how you solved the problem, so others can learn from your experience.



Pattern p1 = Pattern.compile("<h2[^>]*>"+".*?]*>"+"([^<]+)"+"</a[^>]*>");
this is the pattern and now you just need to call the second group which will give the names of the author
13 years ago

Rob Prime wrote:Also, please Use Code Tags.




Thanks i got it but i have new problem i have posted a new post please give a solutionn for that
13 years ago
Hi There
well tell us what is the software DbVisualizer
////
<
>///////
http://www.csc.liv.ac.uk/teaching/modules/year3s1/comp304.html

i need to parse this page and extract the member of staff on this page using regular expression.
Using java.utility.regex

i only need the regular expression rest code i have done

//////
import java.io.*;
import java.net.*;
import java.util.regex.*;

class Spider{
public static void main(String []argv){
try {

URL url = new URL("http://www.csc.liv.ac.uk/teaching/modules/year3s1/comp304.html");
URLConnection urlConnection = url.openConnection();
DataInputStream dis = new DataInputStream(urlConnection.getInputStream());
String html= "", tmp = "";
// read all HTML source from given URL
while ((tmp = dis.readLine()) != null) {
html += " "+tmp;
}
dis.close();

// replace all white spaces region with single space
html = html.replaceAll("\\s+", " ");
// build the pattern using regular expression

//here is the pattern where i have to define a regular expression to find the name of the author from the page
*
*
//please REPLY ME THE REGULAR EXPRESSION NEEDED PLEASE IN THE Pattern.compile
//for the link http://www.csc.liv.ac.uk/teaching/modules/year3s1/comp304.html

Pattern p = Pattern.compile("");
// Match the pattern with given html source
Matcher m = p.matcher(html);
// Get all matches that matched my pattern
while (m.find() == true){
// Print the first matched pattern
System.out.println(m.group(1));
}
}catch (Exception e) {
System.out.println(e);
}
}
}

/////
13 years ago
new bie here
hi i am making a project on online bookstore using struts and hibernate using myeclipse i used tiles definition but its not imported in my jsp
in struts config
please help me this is not working

=============================================================
<struts-config>
<data-sources />
<form-beans>
<form-bean name="bookForm"
type="org.apache.struts.action.DynaActionForm">
<form-property name="search" type="java.lang.String" />
<form-property name="searchtype" type="java.lang.String" />
<form-property name="searchresult" type="java.util.List"></form-property>
</form-bean>
<form-bean name="adminForm"
type="org.apache.struts.action.DynaActionForm">
<form-property name="uname" type="java.lang.String" />
<form-property name="pass" type="java.lang.String" />

</form-bean>
<form-bean name="adminDeleteForm"
type="org.apache.struts.action.DynaActionForm">
<form-property name="isbnno" type="java.lang.String" />

</form-bean>
</form-beans>
<global-exceptions />
<global-forwards>

</global-forwards>
<action-mappings>
<action path="/adminlogin" forward="/adminlogin.jsp"></action>
<action path="/adminoperation" name="adminForm"
type="com.yourcompany.struts.action.adminaction.AdminAction"
input="/adminlogin.jsp" scope="request">
<forward name="adminCRUD" path="/adminCRUD.jsp" />
<forward name="adminlogin" path="/adminlogin.jsp" />
</action>


<action path="/adminInsertUpdate" forward="/adminInsertUpdate.jsp"></action>
<action path="/adminDelete" forward="/adminDelete.jsp"></action>


<action attribute="bookForm" name="bookForm" path="/book"
input="/start.jsp" scope="session"
type="com.yourcompany.struts.action.BookAction">
<forward name="booksearch" path="/booksearch.jsp" />
<forward name="start" path="/start.jsp" />
</action>
<action
attribute="adminDeleteForm"
input="/adminDelete.jsp"
name="adminDeleteForm"
path="/delete"
type="com.yourcompany.struts.action.DeleteAction">
<forward name="adminCRUD" path="/adminCRUD.jsp" />
</action>


<!-- <forward name="sendtoadmin" path="/sendit.do" />-->




</action-mappings>

<message-resources
parameter="com.yourcompany.struts.ApplicationResources" />

<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
<set-property property="moduleAware" value="true" />
<set-property property="definitions-parser-validate" value="true" />
</plug-in>
=====================================================
tiles-defs.xml
well i just put the necessary code
<definition name="main.layout" path="/mainlayout.jsp">

<put name="header" value="/header.jsp" />

<put name="footer" value="/footer.jsp" />

</definition>
<definition name="start.page" extends="main.layout">
<put name="title" value="default page" />
<put name="body" value="/start.jsp" />
</definition>
<definition name="booksearch.page" extends="main.layout">
<put name="title" value="book result page" />
<put name="body" value="/booksearch.jsp" />
</definition>
================================================
start.jsp


<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ page import="java.util.*"%>

<%@ page import="com.yourcompany.ghj.*"%>
<%@ page import="java.util.List"%>
<jsp:directive.page import="com.yourcompany.bookModel.BookSearch" />

<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean"
prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html"
prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic"
prefix="logic"%>

<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles"
prefix="tiles"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-template"
prefix="template"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested"
prefix="nested"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
<head>
<html:base />

<title>start.jsp</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>

<body>
<table>
<tr>

<html:form action="book.do" > 
<html:select property="searchtype">
<html:option value="select">select</html:option>
<html:option value="titlebook">title</html:option>
<html:option value="authorbook">author</html:option>
<html:option value="publisherbook">publisher</html:option>
</html:select>
<html:text property="search"></html:text>
<html:submit>search</html:submit>
</html:form>
<td>
<html:link action="/adminlogin">admin</html:link>
</td>
</tr>
</table>



</body>

</html:html>
======================================================
in xml i put this as the index file
<welcome-file-list>
<welcome-file>start.jsp</welcome-file>
</welcome-file-list>

there are header and footer which i used but i think there is problem of path or name please help me
13 years ago